diff --git a/code/game/objects/items/weapons/material/chainsaw.dm b/code/game/objects/items/weapons/material/chainsaw.dm new file mode 100644 index 0000000000..76db45298d --- /dev/null +++ b/code/game/objects/items/weapons/material/chainsaw.dm @@ -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, "You begin filling the tank on the chainsaw.") + 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, "Chainsaw succesfully refueled.") + else + to_chat(user, "Don't move while you're refilling the chainsaw.") + +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, "The [src] feels like it contains roughtly [get_fuel()] units of fuel left.") + +obj/item/weapon/chainsaw/suicide_act(mob/user) + to_chat(viewers(user), "[user] is lying down and pulling the chainsaw into \him, it looks like \he's trying to commit suicide!") + return(BRUTELOSS) + +obj/item/weapon/chainsaw/update_icon() + if(on) + icon_state = "chainsaw1" + item_state = "chainsaw1" + else + icon_state = "chainsaw0" + icon_state = "chainsaw0" \ No newline at end of file diff --git a/icons/obj/weapons.dmi b/icons/obj/weapons.dmi index 9b434f628d..cf755227ec 100644 Binary files a/icons/obj/weapons.dmi and b/icons/obj/weapons.dmi differ diff --git a/polaris.dme b/polaris.dme index b7121fb693..0cb4c5492c 100644 --- a/polaris.dme +++ b/polaris.dme @@ -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" diff --git a/sound/weapons/chainsaw_attack.ogg b/sound/weapons/chainsaw_attack.ogg new file mode 100644 index 0000000000..b3ab7f4fb8 Binary files /dev/null and b/sound/weapons/chainsaw_attack.ogg differ diff --git a/sound/weapons/chainsaw_startup.ogg b/sound/weapons/chainsaw_startup.ogg new file mode 100644 index 0000000000..865a900f4b Binary files /dev/null and b/sound/weapons/chainsaw_startup.ogg differ diff --git a/sound/weapons/chainsaw_turnoff.ogg b/sound/weapons/chainsaw_turnoff.ogg new file mode 100644 index 0000000000..a031f86dff Binary files /dev/null and b/sound/weapons/chainsaw_turnoff.ogg differ