fixes some issues with whetstones (#18307)

* fixes some issues with whetstones

* merges / simplifies / reorders

* can compress more.

* Active / wielded is no longer needed

* Update code/game/objects/items/weapons/whetstone.dm

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2022-07-16 01:04:19 -04:00
committed by GitHub
parent 1dc0669e12
commit 493571b901
2 changed files with 24 additions and 11 deletions
@@ -2,6 +2,8 @@
var/active = FALSE
var/force_on = 30 //force when active
var/throwforce_on = 20
var/force_off //Used to properly reset the force
var/throwforce_off
var/faction_bonus_force = 0 //Bonus force dealt against certain factions
var/list/nemesis_factions //Any mob with a faction that exists in this list will take bonus damage/effects
stealthy_audio = TRUE //Most of these are antag weps so we dont want them to be /too/ overt.
@@ -19,6 +21,11 @@
var/brightness_on = 2
var/colormap = list(red=LIGHT_COLOR_RED, blue=LIGHT_COLOR_LIGHTBLUE, green=LIGHT_COLOR_GREEN, purple=LIGHT_COLOR_PURPLE, rainbow=LIGHT_COLOR_WHITE)
/obj/item/melee/energy/Initialize(mapload)
. = ..()
force_off = initial(force) //We want to check this only when initializing, not when swapping, so sharpening works.
throwforce_off = initial(throwforce)
/obj/item/melee/energy/attack(mob/living/target, mob/living/carbon/human/user)
var/nemesis_faction = FALSE
if(LAZYLEN(nemesis_factions))
@@ -59,8 +66,8 @@
playsound(user, 'sound/weapons/saberon.ogg', 35, 1) //changed it from 50% volume to 35% because deafness
to_chat(user, "<span class='notice'>[src] is now active.</span>")
else
force = initial(force)
throwforce = initial(throwforce)
force = force_off
throwforce = throwforce_off
hitsound = initial(hitsound)
throw_speed = initial(throw_speed)
if(attack_verb_on.len)
@@ -318,8 +325,8 @@
playsound(user, 'sound/magic/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (active * 30000))
to_chat(user, "<span class='notice'>You open [src]. It will now cleave enemies in a wide arc and deal additional damage to fauna.</span>")
else
force = initial(force)
throwforce = initial(throwforce)
force = force_off
throwforce = throwforce_off
hitsound = initial(hitsound)
throw_speed = initial(throw_speed)
if(attack_verb_on.len)
+13 -7
View File
@@ -25,16 +25,22 @@
return
if(istype(I, /obj/item/twohanded))//some twohanded items should still be sharpenable, but handle force differently. therefore i need this stuff
var/obj/item/twohanded/TH = I
if(TH.force_wielded >= max)
if(TH.force_wielded >= max || TH.force_wielded > initial(TH.force_wielded))
to_chat(user, "<span class='warning'>[TH] is much too powerful to sharpen further!</span>")
return
if(TH.wielded)
to_chat(user, "<span class='warning'>[TH] must be unwielded before it can be sharpened!</span>")
return
if(TH.force_wielded > initial(TH.force_wielded))
to_chat(user, "<span class='warning'>[TH] has already been refined before. It cannot be sharpened further!</span>")
return
TH.force_wielded = clamp(TH.force_wielded + increment, 0, max)//wieldforce is increased since normal force wont stay
TH.force_unwielded = clamp(TH.force_unwielded + increment, 0, max)
if(istype(I, /obj/item/melee/energy))
var/obj/item/melee/energy/E = I
if(E.force_on > initial(E.force_on) || (E.force > initial(E.force)))
to_chat(user, "<span class='warning'>[E] is much too powerful to sharpen further!</span>")
return
E.throwforce_on = clamp(E.throwforce_on + increment, 0, max)
E.throwforce_off = clamp(E.throwforce_off + increment, 0, max)
E.force_on = clamp(E.force_on + increment, 0, max)
E.force_off = clamp(E.force_off + increment, 0, max)
if(I.force > initial(I.force))
to_chat(user, "<span class='warning'>[I] has already been refined before. It cannot be sharpened further!</span>")
return