Files
VOREStation/code/game/objects/items/weapons/material/chainsaw.dm
T
Cameron Lennox d5849910e5 Begin clickcode attack_self fix (#18797)
* Begin clickcode attack_self fix

Begins the work to make everything call back to parent for attack_self so that signals are sacred.

* Makes MORE things call the attack_self() parent

Yes, I could make special_handling a var on obj/item HOWEVER i want it to be specific so it can be tracked down later and ONLY the objects that use it can be refactored instead of sitting there literally forever and it just becoming 'a thing'.

* Finishes making the rest of attack_self call parent.

As mentioned, things such as 'specialty_goggles' 'special_handling' and the such are only there to help with attack_self until the attack_self is recoded for those items.

* begone foul demon

* some more cleanup

* These

* GOD this was annoying

* yeh

* Fix this

* fLARES

* Thesee too

* toys!

* Even more!

* More fixes

* Even more

* rest of em

* these too

* Update syndie.dm

* hardref clear

* Update code/game/gamemodes/nuclear/pinpointer.dm

* Update code/game/objects/effects/mines.dm

* Update code/game/objects/items/blueprints_vr.dm

* Update code/game/objects/items/blueprints_vr.dm

* Update code/game/objects/items/contraband_vr.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/gunbox.dm

* Update code/game/objects/items/gunbox.dm

* Update code/game/objects/items/gunbox_vr.dm

* Update code/game/objects/items/gunbox_vr.dm

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

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/crayons.dm

* Update code/game/objects/items/gunbox.dm

* these too

* Update maintpanel_stack.dm

* angry warning

* Fixes packaged snacks.

Fixes improper var default.

* Special handling for these

* proper poly types

* Fixes magclaws

Makes the 'features' it had just part  of base magboots that can be adjusted via varswap.

* Fixes jackets

Fixes https://github.com/VOREStation/VOREStation/issues/18941

* Small bugfix

Makes p_Theyre properly capitialize
Makes examine show proper wording

* Update gift_wrappaper.dm
2025-12-29 13:21:10 -05:00

128 lines
3.7 KiB
Plaintext

/obj/item/chainsaw
name = "chainsaw"
desc = "Vroom vroom."
icon_state = "chainsaw0"
item_state = "chainsaw0"
var/on = 0
var/max_fuel = 100
w_class = ITEMSIZE_LARGE
slot_flags = SLOT_BACK
w_class = ITEMSIZE_LARGE
slot_flags = SLOT_BACK
var/active_force = 55
var/inactive_force = 10
/obj/item/chainsaw/Initialize(mapload)
var/datum/reagents/R = new/datum/reagents(max_fuel)
reagents = R
R.my_atom = src
R.add_reagent(REAGENT_ID_FUEL, max_fuel)
START_PROCESSING(SSobj, src)
. = ..()
/obj/item/chainsaw/Destroy()
STOP_PROCESSING(SSobj, src)
. = ..()
/obj/item/chainsaw/proc/turnOn(mob/user as mob)
if(on) return
visible_message("You start pulling the string on \the [src].", "[user] starts pulling the string on the [src].")
if(max_fuel <= 0)
if(do_after(user, 15, target = src))
to_chat(user, "\The [src] won't start!")
else
to_chat(user, "You fumble with the string.")
else
if(do_after(user, 15, target = src))
visible_message("You start \the [src] up with a loud grinding!", "[user] starts \the [src] up with a loud grinding!")
attack_verb = list("shredded", "ripped", "torn")
playsound(src, 'sound/weapons/chainsaw_startup.ogg',40,1)
force = active_force
edge = TRUE
sharp = TRUE
on = 1
update_icon()
else
to_chat(user, "You fumble with the string.")
/obj/item/chainsaw/proc/turnOff(mob/user as mob)
if(!on) return
to_chat(user, "You switch the gas nozzle on the chainsaw, turning it off.")
attack_verb = list("bluntly hit", "beat", "knocked")
playsound(src, 'sound/weapons/chainsaw_turnoff.ogg',40,1)
force = inactive_force
edge = FALSE
sharp = FALSE
on = 0
update_icon()
/obj/item/chainsaw/attack_self(mob/user)
. = ..(user)
if(.)
return TRUE
if(!on)
turnOn(user)
else
turnOff(user)
/obj/item/chainsaw/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity)
if(!proximity) return
..()
if(on)
playsound(src, 'sound/weapons/chainsaw_attack.ogg',40,1)
if(A && on)
if(get_fuel() > 0)
reagents.remove_reagent(REAGENT_ID_FUEL, 1)
if(istype(A,/obj/structure/window))
var/obj/structure/window/W = A
W.shatter()
else if(istype(A,/obj/structure/grille))
new /obj/structure/grille/broken(A.loc)
new /obj/item/stack/rods(A.loc)
qdel(A)
else if(istype(A,/obj/effect/plant))
var/obj/effect/plant/P = A
qdel(P) //Plant isn't surviving that. At all
else if(istype(A,/obj/machinery/portable_atmospherics/hydroponics))
var/obj/machinery/portable_atmospherics/hydroponics/Hyd = A
if(Hyd.seed && !Hyd.dead)
to_chat(user, span_notice("You shred the plant."))
Hyd.die()
if (istype(A, /obj/structure/reagent_dispensers/fueltank) && get_dist(src,A) <= 1)
to_chat(user, span_notice("You begin filling the tank on the chainsaw."))
if(do_after(user, 15, target = src))
A.reagents.trans_to_obj(src, max_fuel)
playsound(src, 'sound/effects/refill.ogg', 50, 1, -6)
to_chat(user, span_notice("Chainsaw succesfully refueled."))
else
to_chat(user, span_notice("Don't move while you're refilling the chainsaw."))
/obj/item/chainsaw/process()
if(!on) return
if(on)
if(get_fuel() > 0)
reagents.remove_reagent(REAGENT_ID_FUEL, 1)
playsound(src, 'sound/weapons/chainsaw_turnoff.ogg',15,1)
if(get_fuel() <= 0)
to_chat(usr, "\The [src] sputters to a stop!")
turnOff()
/obj/item/chainsaw/proc/get_fuel()
return reagents.get_reagent_amount(REAGENT_ID_FUEL)
/obj/item/chainsaw/examine(mob/user)
. = ..()
if(max_fuel && get_dist(user, src) == 0)
. += span_notice("The [src] feels like it contains roughtly [get_fuel()] units of fuel left.")
/obj/item/chainsaw/update_icon()
if(on)
icon_state = "chainsaw1"
item_state = "chainsaw1"
else
icon_state = "chainsaw0"
item_state = "chainsaw0"