Skip to content

Commit 87220d3

Browse files
authored
Blacksmithing quality affects tool-use speed. (#37775)
* fancy truncate proc * dorfify toolspeed * hammer time
1 parent 5732326 commit 87220d3

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

__DEFINES/math_physics.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@
5959

6060
#define IS_INT(x) (x == round(x))
6161

62+
#define fancytrunc(x, y) (floor(x*(y*10))/(y*10)) //X is the value to truncate, Y is the trunc multiplier, i.e: x,3 would truncate to the thousandth.
63+
6264
#define GLIDE_SIZE_OF_A_WALKING_HUMAN 2.4615386

code/game/objects/items.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,7 @@ var/global/objects_thrown_when_explode = FALSE
16881688
armor["melee"] = min(90, armor["melee"]*(material_type.armor_mod*(quality/B_AVERAGE)))
16891689
armor["bullet"] = min(90, armor["bullet"]*(material_type.armor_mod*(quality/B_AVERAGE)))
16901690
armor["laser"] = min(90, armor["laser"]*(material_type.armor_mod*(quality/B_AVERAGE)))
1691+
toolspeed = fancytrunc(toolspeed * (0.6687**(quality-4)),2)
16911692

16921693
/////// DISEASE STUFF //////////////////////////////////////////////////////////////////////////
16931694

code/modules/blacksmithing/blacksmithing.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
/obj/item/smithing_placeholder/attackby(obj/item/I, mob/user)
9393
if(ishammer(I))
9494
strike(I, user)
95-
user.delayNextAttack(1 SECONDS)
95+
user.delayNextAttack(1.4-(0.1*I.quality) SECONDS)
9696
else if (I.is_hot())
9797
heat(I.is_hot(), I, user)
9898

0 commit comments

Comments
 (0)