From 70c3fb81a6cd71dba18fc2f640c54247f287a97f Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Wed, 2 May 2018 18:05:39 -0400 Subject: [PATCH] Buffs DIY Chainsaw --- code/game/objects/items/weapons/twohanded.dm | 255 +++++++++---------- 1 file changed, 127 insertions(+), 128 deletions(-) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 7bae5139b27..f0aa0bd1292 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -23,19 +23,20 @@ * Twohanded */ /obj/item/twohanded - var/wielded = 0 + var/wielded = FALSE var/force_unwielded = 0 var/force_wielded = 0 var/wieldsound = null var/unwieldsound = null /obj/item/twohanded/proc/unwield(mob/living/carbon/user) - if(!wielded || !user) return - wielded = 0 + if(!wielded || !user) + return + wielded = FALSE force = force_unwielded var/sf = findtext(name," (Wielded)") if(sf) - name = copytext(name,1,sf) + name = copytext(name, 1, sf) else //something wrong name = "[initial(name)]" update_icon() @@ -45,16 +46,16 @@ if(isrobot(user)) to_chat(user, "You free up your module.") else - to_chat(user, "You are now carrying the [name] with one hand.") + to_chat(user, "You are now carrying [name] with one hand.") if(unwieldsound) playsound(loc, unwieldsound, 50, 1) var/obj/item/twohanded/offhand/O = user.get_inactive_hand() if(O && istype(O)) O.unwield() - return /obj/item/twohanded/proc/wield(mob/living/carbon/user) - if(wielded) return + if(wielded) + return if(ishuman(user)) var/mob/living/carbon/human/H = user if(H.species.is_small) @@ -63,7 +64,7 @@ if(user.get_inactive_hand()) to_chat(user, "You need your other hand to be empty!") return - wielded = 1 + wielded = TRUE force = force_wielded name = "[name] (Wielded)" update_icon() @@ -80,7 +81,6 @@ O.name = "[name] - offhand" O.desc = "Your second grip on the [name]" user.put_in_inactive_hand(O) - return /obj/item/twohanded/dropped(mob/user) ..() @@ -124,22 +124,22 @@ ///////////Two hand required objects/////////////// //This is for objects that require two hands to even pick up -/obj/item/twohanded/required/ +/obj/item/twohanded/required w_class = WEIGHT_CLASS_HUGE /obj/item/twohanded/required/attack_self() return -/obj/item/twohanded/required/mob_can_equip(M as mob, slot) +/obj/item/twohanded/required/mob_can_equip(mob/M, slot) if(wielded && !slot_flags) to_chat(M, "[src] is too cumbersome to carry with anything but your hands!") - return 0 + return FALSE return ..() /obj/item/twohanded/required/attack_hand(mob/user)//Can't even pick it up without both hands empty var/obj/item/twohanded/required/H = user.get_inactive_hand() - if(get_dist(src,user) > 1) - return 0 + if(get_dist(src, user) > 1) + return FALSE if(H != null) to_chat(user, "[src] is too cumbersome to carry in one hand!") return @@ -163,7 +163,7 @@ desc = "Truly, the weapon of a madman. Who would think to fight fire with an axe?" force = 5 throwforce = 15 - sharp = 1 + sharp = TRUE w_class = WEIGHT_CLASS_BULKY slot_flags = SLOT_BACK force_unwielded = 5 @@ -174,10 +174,10 @@ /obj/item/twohanded/fireaxe/update_icon() //Currently only here to fuck with the on-mob icons. icon_state = "fireaxe[wielded]" - return -/obj/item/twohanded/fireaxe/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity) - if(!proximity) return +/obj/item/twohanded/fireaxe/afterattack(atom/A, mob/user, proximity) + if(!proximity) + return ..() if(A && wielded && (istype(A,/obj/structure/window) || istype(A,/obj/structure/grille))) //destroys windows and grilles in one hit @@ -191,13 +191,13 @@ * Double-Bladed Energy Swords - Cheridan */ /obj/item/twohanded/dualsaber - var/hacked = 0 + var/hacked = FALSE var/blade_color icon_state = "dualsaber0" name = "double-bladed energy sword" desc = "Handle with care." force = 3 - throwforce = 5.0 + throwforce = 5 throw_speed = 1 throw_range = 5 w_class = WEIGHT_CLASS_SMALL @@ -209,7 +209,7 @@ origin_tech = "magnets=4;syndicate=5" attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") block_chance = 75 - sharp = 1 + sharp = TRUE light_power = 2 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) @@ -226,26 +226,30 @@ icon_state = "dualsaber0" set_light(0) -/obj/item/twohanded/dualsaber/attack(target as mob, mob/living/user as mob) +/obj/item/twohanded/dualsaber/attack(mob/target, mob/living/user) if(HULK in user.mutations) to_chat(user, "You grip the blade too hard and accidentally close it!") unwield() return ..() - if((CLUMSY in user.mutations) && (wielded) &&prob(40)) + if((CLUMSY in user.mutations) && (wielded) && prob(40)) to_chat(user, "You twirl around a bit before losing your balance and impaling yourself on the [src].") - user.take_organ_damage(20,25) + user.take_organ_damage(20, 25) return if((wielded) && prob(50)) - spawn(0) - for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2)) - user.dir = i - sleep(1) + INVOKE_ASYNC(src, .proc/jedi_spin, user) + +/obj/item/twohanded/dualsaber/proc/jedi_spin(mob/living/user) + for(var/i in list(NORTH, SOUTH, EAST, WEST, EAST, SOUTH, NORTH, SOUTH, EAST, WEST, EAST, SOUTH)) + user.setDir(i) + if(i == WEST) + user.SpinAnimation(7, 1) + sleep(1) /obj/item/twohanded/dualsaber/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance) if(wielded) return ..() - return 0 + return FALSE /obj/item/twohanded/dualsaber/green blade_color = "green" @@ -265,7 +269,7 @@ /obj/item/twohanded/dualsaber/IsReflect() if(wielded) - return 1 + return TRUE /obj/item/twohanded/dualsaber/wield(mob/living/carbon/M) //Specific wield () hulk checks due to reflection chance for balance issues and switches hitsounds. if(HULK in M.mutations) @@ -274,16 +278,17 @@ ..() hitsound = 'sound/weapons/blade1.ogg' -/obj/item/twohanded/dualsaber/attackby(obj/item/W as obj, mob/user as mob, params) - ..() - if(istype(W, /obj/item/multitool)) - if(hacked == 0) - hacked = 1 +/obj/item/twohanded/dualsaber/attackby(obj/item/W, mob/user, params) + if(ismultitool(W)) + if(!hacked) + hacked = TRUE to_chat(user, "2XRNBW_ENGAGE") blade_color = "rainbow" update_icon() else to_chat(user, "It's starting to look like a triple rainbow - no, nevermind.") + else + return ..() //spears /obj/item/twohanded/spear @@ -298,11 +303,11 @@ throwforce = 20 throw_speed = 4 armour_penetration = 10 - materials = list(MAT_METAL=1150, MAT_GLASS=2075) + materials = list(MAT_METAL = 1150, MAT_GLASS = 2075) hitsound = 'sound/weapons/bladeslice.ogg' attack_verb = list("attacked", "poked", "jabbed", "torn", "gored") - sharp = 1 - no_spin_thrown = 1 + sharp = TRUE + no_spin_thrown = TRUE var/obj/item/grenade/explosive = null var/war_cry = "AAAAARGH!!!" @@ -333,8 +338,8 @@ ..() if(!explosive) return - if(ismob(loc)) - var/mob/M = loc + if(ishuman(loc)) + var/mob/living/carbon/human/M = loc var/input = stripped_input(M, "What do you want your war cry to be? You will shout it when you hit someone in melee.", ,"", 50) if(input) war_cry = input @@ -381,48 +386,47 @@ M.GiveTarget(L) //Putting heads on spears -/obj/item/organ/external/head/attackby(var/obj/item/W, var/mob/living/user, params) - if(istype(W, /obj/item/twohanded/spear)) - to_chat(user, "You stick the head onto the spear and stand it upright on the ground.") - var/obj/structure/headspear/HS = new /obj/structure/headspear(user.loc) - var/matrix/M = matrix() - src.transform = M - user.drop_item() - src.loc = HS - var/image/IM = image(src.icon,src.icon_state) - IM.overlays = src.overlays.Copy() - HS.overlays += IM - qdel(W) - return - return ..() - -/obj/item/twohanded/spear/attackby(var/obj/item/I, var/mob/living/user) +/obj/item/twohanded/spear/attackby(obj/item/I, mob/living/user) if(istype(I, /obj/item/organ/external/head)) - to_chat(user, "You stick the head onto the spear and stand it upright on the ground.") - var/obj/structure/headspear/HS = new /obj/structure/headspear(user.loc) - var/matrix/M = matrix() - I.transform = M - usr.drop_item() - I.loc = HS - var/image/IM = image(I.icon,I.icon_state) - IM.overlays = I.overlays.Copy() - HS.overlays += IM - qdel(src) - return - return ..() + if(user.unEquip(src) && user.drop_item()) + to_chat(user, "You stick [I] onto the spear and stand it upright on the ground.") + var/obj/structure/headspear/HS = new /obj/structure/headspear(get_turf(src)) + var/matrix/M = matrix() + I.transform = M + var/image/IM = image(I.icon, I.icon_state) + IM.overlays = I.overlays.Copy() + HS.overlays += IM + I.forceMove(HS) + HS.mounted_head = I + forceMove(HS) + HS.contained_spear = src + else + return ..() /obj/structure/headspear name = "head on a spear" desc = "How barbaric." icon_state = "headspear" - density = 0 - anchored = 1 + density = FALSE + anchored = TRUE + var/obj/item/organ/external/head/mounted_head = null + var/obj/item/twohanded/spear/contained_spear = null + +/obj/structure/headspear/Destroy() + QDEL_NULL(mounted_head) + QDEL_NULL(contained_spear) + return ..() /obj/structure/headspear/attack_hand(mob/living/user) - user.visible_message("[user] kicks over \the [src]!", "You kick down \the [src]!") - new /obj/item/twohanded/spear(user.loc) - for(var/obj/item/organ/external/head/H in src) - H.loc = user.loc + user.visible_message("[user] kicks over [src]!", "You kick down [src]!") + playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) + var/turf/T = get_turf(src) + if(contained_spear) + contained_spear.forceMove(T) + contained_spear = null + if(mounted_head) + mounted_head.forceMove(T) + mounted_head = null qdel(src) /obj/item/twohanded/spear/kidan @@ -437,18 +441,18 @@ icon_state = "gchainsaw_off" flags = CONDUCT force = 13 - var/force_on = 21 + var/force_on = 24 w_class = WEIGHT_CLASS_HUGE throwforce = 13 throw_speed = 2 throw_range = 4 - materials = list(MAT_METAL=13000) + materials = list(MAT_METAL = 13000) origin_tech = "materials=3;engineering=4;combat=2" attack_verb = list("sawed", "cut", "hacked", "carved", "cleaved", "butchered", "felled", "timbered") hitsound = "swing_hit" - sharp = 1 + sharp = TRUE actions_types = list(/datum/action/item_action/startchainsaw) - var/on = 0 + var/on = FALSE /obj/item/twohanded/required/chainsaw/attack_self(mob/user) on = !on @@ -481,8 +485,8 @@ if(attack_type == PROJECTILE_ATTACK) owner.visible_message("Ranged attacks just make [owner] angrier!") playsound(src, pick('sound/weapons/bulletflyby.ogg','sound/weapons/bulletflyby2.ogg','sound/weapons/bulletflyby3.ogg'), 75, 1) - return 1 - return 0 + return TRUE + return FALSE ///CHAINSAW/// @@ -502,7 +506,7 @@ armour_penetration = 35 origin_tech = "materials=6;syndicate=4" attack_verb = list("sawed", "cut", "hacked", "carved", "cleaved", "butchered", "felled", "timbered") - sharp = 1 + sharp = TRUE /obj/item/twohanded/chainsaw/update_icon() if(wielded) @@ -510,7 +514,7 @@ else icon_state = "chainsaw0" -/obj/item/twohanded/chainsaw/attack(mob/target as mob, mob/living/user as mob) +/obj/item/twohanded/chainsaw/attack(mob/target, mob/living/user) if(wielded) playsound(loc, 'sound/weapons/chainsaw.ogg', 100, 1, -1) //incredibly loud; you ain't goin' for stealth with this thing. Credit to Lonemonk of Freesound for this sound. if(isrobot(target)) @@ -562,43 +566,41 @@ /obj/item/twohanded/singularityhammer/process() if(charged < 5) charged++ - return /obj/item/twohanded/singularityhammer/update_icon() //Currently only here to fuck with the on-mob icons. icon_state = "mjollnir[wielded]" - return -/obj/item/twohanded/singularityhammer/proc/vortex(var/turf/pull as turf, mob/wielder as mob) - for(var/atom/X in orange(5,pull)) - if(istype(X, /atom/movable)) - if(X == wielder) continue - if((X) &&(!X:anchored) && (!istype(X,/mob/living/carbon/human))) - step_towards(X,pull) - step_towards(X,pull) - step_towards(X,pull) - else if(istype(X,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = X - if(istype(H.shoes,/obj/item/clothing/shoes/magboots)) - var/obj/item/clothing/shoes/magboots/M = H.shoes - if(M.magpulse) - continue - H.apply_effect(1, WEAKEN, 0) - step_towards(H,pull) - step_towards(H,pull) - step_towards(H,pull) - return +/obj/item/twohanded/singularityhammer/proc/vortex(turf/pull, mob/wielder) + for(var/atom/movable/X in orange(5, pull)) + if(X == wielder) + continue + if((X) && (!X.anchored) && (!ishuman(X))) + step_towards(X, pull) + step_towards(X, pull) + step_towards(X, pull) + else if(ishuman(X)) + var/mob/living/carbon/human/H = X + if(istype(H.shoes, /obj/item/clothing/shoes/magboots)) + var/obj/item/clothing/shoes/magboots/M = H.shoes + if(M.magpulse) + continue + H.apply_effect(1, WEAKEN, 0) + step_towards(H, pull) + step_towards(H, pull) + step_towards(H, pull) -/obj/item/twohanded/singularityhammer/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity) - if(!proximity) return +/obj/item/twohanded/singularityhammer/afterattack(atom/A, mob/user, proximity) + if(!proximity) + return if(wielded) if(charged == 5) charged = 0 - if(istype(A, /mob/living/)) + if(isliving(A)) var/mob/living/Z = A - Z.take_organ_damage(20,0) + Z.take_organ_damage(20, 0) playsound(user, 'sound/weapons/marauder.ogg', 50, 1) var/turf/target = get_turf(A) - vortex(target,user) + vortex(target, user) /obj/item/twohanded/mjollnir name = "Mjolnir" @@ -615,37 +617,35 @@ //var/charged = 5 origin_tech = "combat=4;powerstorage=7" -/obj/item/twohanded/mjollnir/proc/shock(mob/living/target as mob) +/obj/item/twohanded/mjollnir/proc/shock(mob/living/target) var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread() s.set_up(5, 1, target.loc) s.start() - target.visible_message("[target.name] was shocked by the [src.name]!", \ + target.visible_message("[target.name] was shocked by the [name]!", \ "You feel a powerful shock course through your body sending you flying!", \ "You hear a heavy electrical crack!") var/atom/throw_target = get_edge_target_turf(target, get_dir(src, get_step_away(target, src))) target.throw_at(throw_target, 200, 4) - return -/obj/item/twohanded/mjollnir/attack(mob/M as mob, mob/user as mob) +/obj/item/twohanded/mjollnir/attack(mob/M, mob/user) ..() if(wielded) //if(charged == 5) //charged = 0 - playsound(src.loc, "sparks", 50, 1) - if(istype(M, /mob/living)) + playsound(loc, "sparks", 50, 1) + if(isliving(M)) M.Stun(3) shock(M) /obj/item/twohanded/mjollnir/throw_impact(atom/target) . = ..() - if(istype(target, /mob/living)) + if(isliving(target)) var/mob/living/L = target L.Stun(3) shock(L) /obj/item/twohanded/mjollnir/update_icon() //Currently only here to fuck with the on-mob icons. icon_state = "mjollnir[wielded]" - return /obj/item/twohanded/knighthammer name = "singuloth knight's hammer" @@ -673,27 +673,26 @@ /obj/item/twohanded/knighthammer/process() if(charged < 5) charged++ - return /obj/item/twohanded/knighthammer/update_icon() //Currently only here to fuck with the on-mob icons. icon_state = "knighthammer[wielded]" - return -/obj/item/twohanded/knighthammer/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity) - if(!proximity) return +/obj/item/twohanded/knighthammer/afterattack(atom/A, mob/user, proximity) + if(!proximity) + return if(charged == 5) charged = 0 - if(istype(A, /mob/living/)) + if(isliving(A)) var/mob/living/Z = A if(Z.health >= 1) - Z.visible_message("[Z.name] was sent flying by a blow from the [src.name]!", \ + Z.visible_message("[Z.name] was sent flying by a blow from the [name]!", \ "You feel a powerful blow connect with your body and send you flying!", \ "You hear something heavy impact flesh!.") var/atom/throw_target = get_edge_target_turf(Z, get_dir(src, get_step_away(Z, src))) Z.throw_at(throw_target, 200, 4) playsound(user, 'sound/weapons/marauder.ogg', 50, 1) else if(wielded && Z.health < 1) - Z.visible_message("[Z.name] was blown to peices by the power of [src.name]!", \ + Z.visible_message("[Z.name] was blown to peices by the power of [name]!", \ "You feel a powerful blow rip you apart!", \ "You hear a heavy impact and the sound of ripping flesh!.") Z.gib() @@ -704,7 +703,7 @@ Z.ex_act(2) charged = 3 playsound(user, 'sound/weapons/marauder.ogg', 50, 1) - else if(istype(A, /obj/structure) || istype(A, /obj/mecha/)) + else if(istype(A, /obj/structure) || istype(A, /obj/mecha)) var/obj/Z = A Z.ex_act(2) charged = 3 @@ -717,7 +716,7 @@ icon_state = "fireaxe0" force = 5 throwforce = 15 - sharp = 1 + sharp = TRUE w_class = WEIGHT_CLASS_HUGE armour_penetration = 20 slot_flags = SLOT_BACK @@ -737,11 +736,11 @@ if(!proximity) return if(wielded) - if(istype(A, /mob/living)) + if(isliving(A)) var/mob/living/Z = A if(charged) charged-- - Z.take_organ_damage(0,30) + Z.take_organ_damage(0, 30) user.visible_message("[user] slams the charged axe into [Z.name] with all their might!") playsound(loc, 'sound/magic/lightningbolt.ogg', 5, 1) var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread @@ -759,4 +758,4 @@ qdel(A) if(prob(4)) charged++ - user.visible_message("The axe starts to emit an electric buzz!") + user.visible_message("The axe starts to emit an electric buzz!") \ No newline at end of file