mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-11 17:35:05 +00:00
About The Pull Request Converts every single usage of playsound's vary parameter to use the boolean define instead of 1 or 0. I'm tired of people copypasting the incorrect usage. Also changes a couple of places where a list was picked from instead of using get_sfx internal calls This was done via regex: (playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\)) to match 1 (playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\)) to match 0 full sed commands: /(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\))/\1TRUE\2/ 1 to TRUE /(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\))/\1FALSE\2/ 0 to FALSE I'm not very good with regex and these could probably be optimized, but they worked. Why It's Good For The Game Code usability
60 lines
2.5 KiB
Plaintext
60 lines
2.5 KiB
Plaintext
/obj/item/sharpener
|
|
name = "whetstone"
|
|
icon = 'icons/obj/kitchen.dmi'
|
|
icon_state = "sharpener"
|
|
desc = "A block that makes things sharp."
|
|
force = 5
|
|
var/used = 0
|
|
var/increment = 4
|
|
var/max = 30
|
|
var/prefix = "sharpened"
|
|
var/requires_sharpness = 1
|
|
|
|
|
|
/obj/item/sharpener/attackby(obj/item/I, mob/user, params)
|
|
if(used)
|
|
to_chat(user, "<span class='warning'>The sharpening block is too worn to use again!</span>")
|
|
return
|
|
if(I.force >= max || I.throwforce >= max)//no esword sharpening
|
|
to_chat(user, "<span class='warning'>[I] is much too powerful to sharpen further!</span>")
|
|
return
|
|
if(requires_sharpness && !I.is_sharp())
|
|
to_chat(user, "<span class='warning'>You can only sharpen items that are already sharp, such as knives!</span>")
|
|
return
|
|
if(istype(I, /obj/item/melee/transforming/energy))
|
|
to_chat(user, "<span class='warning'>You don't think \the [I] will be the thing getting modified if you use it on \the [src]!</span>")
|
|
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)
|
|
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
|
|
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
|
|
user.visible_message("<span class='notice'>[user] sharpens [I] with [src]!</span>", "<span class='notice'>You sharpen [I], making it much more deadly than before.</span>")
|
|
playsound(src, 'sound/items/unsheath.ogg', 25, TRUE)
|
|
I.sharpness = IS_SHARP_ACCURATE
|
|
I.force = CLAMP(I.force + increment, 0, max)
|
|
I.throwforce = CLAMP(I.throwforce + increment, 0, max)
|
|
I.name = "[prefix] [I.name]"
|
|
name = "worn out [name]"
|
|
desc = "[desc] At least, it used to."
|
|
used = 1
|
|
update_icon()
|
|
|
|
/obj/item/sharpener/super
|
|
name = "super whetstone"
|
|
desc = "A block that will make your weapon sharper than Einstein on adderall."
|
|
increment = 200
|
|
max = 200
|
|
prefix = "super-sharpened"
|
|
requires_sharpness = 0
|