mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Fixy fixy. (#4314)
This commit is contained in:
112
code/game/objects/items/weapons/material/chainsaw.dm
Normal file
112
code/game/objects/items/weapons/material/chainsaw.dm
Normal file
@@ -0,0 +1,112 @@
|
||||
obj/item/weapon/chainsaw
|
||||
name = "Chainsaw"
|
||||
desc = "Vroom vroom."
|
||||
icon_state = "chainsaw0"
|
||||
var/on = 0
|
||||
var/max_fuel = 20
|
||||
w_class = ITEMSIZE_LARGE
|
||||
slot_flags = SLOT_BACK
|
||||
w_class = ITEMSIZE_LARGE
|
||||
slot_flags = SLOT_BACK
|
||||
|
||||
obj/item/weapon/chainsaw/New()
|
||||
var/datum/reagents/R = new/datum/reagents(max_fuel)
|
||||
reagents = R
|
||||
R.my_atom = src
|
||||
R.add_reagent("fuel", max_fuel)
|
||||
..()
|
||||
|
||||
obj/item/weapon/chainsaw/proc/turnOn()
|
||||
if(on) return
|
||||
|
||||
visible_message("You start pulling the string on \the [src].", "[usr] starts pulling the string on the [src].")
|
||||
|
||||
if(max_fuel <= 0)
|
||||
if(do_after(usr, 15))
|
||||
to_chat(usr, "\The [src] won't start!")
|
||||
else
|
||||
to_chat(usr, "You fumble with the string.")
|
||||
else
|
||||
if(do_after(usr, 15))
|
||||
visible_message("You start \the [src] up with a loud grinding!", "[usr] starts \the [src] up with a loud grinding!")
|
||||
attack_verb = list("shreds", "rips", "tears")
|
||||
playsound(src, 'sound/weapons/chainsaw_startup.ogg',40,1)
|
||||
force = 55
|
||||
edge = 1
|
||||
sharp = 1
|
||||
on = 1
|
||||
update_icon()
|
||||
else
|
||||
to_chat(usr, "You fumble with the string.")
|
||||
|
||||
obj/item/weapon/chainsaw/proc/turnOff()
|
||||
if(!on) return
|
||||
to_chat(usr, "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 = 10
|
||||
edge = 0
|
||||
sharp = 0
|
||||
on = 0
|
||||
update_icon()
|
||||
|
||||
obj/item/weapon/chainsaw/attack_self(mob/user as mob)
|
||||
if(!on)
|
||||
turnOn()
|
||||
else
|
||||
turnOff()
|
||||
|
||||
obj/item/weapon/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(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
|
||||
if (istype(A, /obj/structure/reagent_dispensers/fueltank) && get_dist(src,A) <= 1)
|
||||
to_chat(user, "<span class='notice'>You begin filling the tank on the chainsaw.</span>")
|
||||
if(do_after(usr, 15))
|
||||
A.reagents.trans_to_obj(src, max_fuel)
|
||||
playsound(src.loc, 'sound/effects/refill.ogg', 50, 1, -6)
|
||||
to_chat(user, "<span class='notice'>Chainsaw succesfully refueled.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Don't move while you're refilling the chainsaw.</span>")
|
||||
|
||||
obj/item/weapon/chainsaw/process()
|
||||
if(!on) return
|
||||
|
||||
if(on)
|
||||
if(get_fuel() > 0)
|
||||
reagents.remove_reagent("fuel", 1)
|
||||
if(get_fuel() <= 0)
|
||||
to_chat(usr, "\The [src] sputters to a stop!")
|
||||
on = !on
|
||||
|
||||
obj/item/weapon/chainsaw/proc/get_fuel()
|
||||
reagents.get_reagent_amount("fuel")
|
||||
|
||||
obj/item/weapon/chainsaw/examine(mob/user)
|
||||
if(..(user,0))
|
||||
if(max_fuel)
|
||||
to_chat(usr, "<span class = 'notice'>The [src] feels like it contains roughtly [get_fuel()] units of fuel left.</span>")
|
||||
|
||||
obj/item/weapon/chainsaw/suicide_act(mob/user)
|
||||
to_chat(viewers(user), "<span class='danger'>[user] is lying down and pulling the chainsaw into \him, it looks like \he's trying to commit suicide!</span>")
|
||||
return(BRUTELOSS)
|
||||
|
||||
obj/item/weapon/chainsaw/update_icon()
|
||||
if(on)
|
||||
icon_state = "chainsaw1"
|
||||
item_state = "chainsaw1"
|
||||
else
|
||||
icon_state = "chainsaw0"
|
||||
icon_state = "chainsaw0"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 41 KiB |
@@ -955,6 +955,7 @@
|
||||
#include "code\game\objects\items\weapons\implants\implantuplink.dm"
|
||||
#include "code\game\objects\items\weapons\material\ashtray.dm"
|
||||
#include "code\game\objects\items\weapons\material\bats.dm"
|
||||
#include "code\game\objects\items\weapons\material\chainsaw.dm"
|
||||
#include "code\game\objects\items\weapons\material\foam.dm"
|
||||
#include "code\game\objects\items\weapons\material\gravemarker.dm"
|
||||
#include "code\game\objects\items\weapons\material\kitchen.dm"
|
||||
|
||||
BIN
sound/weapons/chainsaw_attack.ogg
Normal file
BIN
sound/weapons/chainsaw_attack.ogg
Normal file
Binary file not shown.
BIN
sound/weapons/chainsaw_startup.ogg
Normal file
BIN
sound/weapons/chainsaw_startup.ogg
Normal file
Binary file not shown.
BIN
sound/weapons/chainsaw_turnoff.ogg
Normal file
BIN
sound/weapons/chainsaw_turnoff.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user