From 20394282ff687a9dda06237e646e63ee64929eb3 Mon Sep 17 00:00:00 2001 From: Cruix Date: Mon, 26 Dec 2016 12:13:46 -0800 Subject: [PATCH] Fixed some two-handed weapon bugs (#22457) * Fixed being able to hold twohanded-required items in one hand Fixed dualsabers changing their weight_class and hitsound when unsuccessfully wielded * Fixed ctf flags being unpickupable --- _maps/map_files/generic/z2.dmm | 4 +- code/game/objects/items/weapons/twohanded.dm | 45 ++++++++++++------- code/game/objects/structures/flora.dm | 1 + code/modules/awaymissions/capture_the_flag.dm | 26 +++++------ 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/_maps/map_files/generic/z2.dmm b/_maps/map_files/generic/z2.dmm index cd9bdb86f40..df5ca316384 100644 --- a/_maps/map_files/generic/z2.dmm +++ b/_maps/map_files/generic/z2.dmm @@ -395,8 +395,8 @@ "hE" = (/turf/open/floor/plasteel/circuit/rcircuit,/area/ctf) "hF" = (/turf/open/floor/plasteel/circuit/gcircuit/animated,/area/ctf) "hG" = (/obj/machinery/capture_the_flag/blue,/turf/open/floor/plasteel/circuit/gcircuit/animated,/area/ctf) -"hH" = (/obj/item/weapon/twohanded/required/ctf/blue,/turf/open/floor/plasteel/circuit/gcircuit/animated,/area/ctf) -"hI" = (/obj/item/weapon/twohanded/required/ctf/red,/turf/open/floor/plasteel/circuit/gcircuit/animated,/area/ctf) +"hH" = (/obj/item/weapon/twohanded/ctf/blue,/turf/open/floor/plasteel/circuit/gcircuit/animated,/area/ctf) +"hI" = (/obj/item/weapon/twohanded/ctf/red,/turf/open/floor/plasteel/circuit/gcircuit/animated,/area/ctf) "hJ" = (/obj/machinery/capture_the_flag/red,/turf/open/floor/plasteel/circuit/gcircuit/animated,/area/ctf) "hK" = (/obj/effect/landmark/shuttle_import,/turf/open/space,/area/space) "hL" = (/turf/open/floor/plasteel/darkblue/side{tag = "icon-darkblue (SOUTHWEST)";dir = 10},/turf/open/floor/plasteel/warningline{tag = "icon-warningline (SOUTHWEST)";dir = 10},/area/ctf) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index e0dcb0a6dd0..a3eb1d57443 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -29,7 +29,7 @@ var/wieldsound = null var/unwieldsound = null -/obj/item/weapon/twohanded/proc/unwield(mob/living/carbon/user) +/obj/item/weapon/twohanded/proc/unwield(mob/living/carbon/user, show_message = TRUE) if(!wielded || !user) return wielded = 0 @@ -41,12 +41,11 @@ else //something wrong name = "[initial(name)]" update_icon() - if(iscyborg(user)) - user << "You free up your module." - else if(istype(src, /obj/item/weapon/twohanded/required)) - user << "You drop [src]." - else - user << "You are now carrying [src] with one hand." + if(show_message) + if(iscyborg(user)) + user << "You free up your module." + else + user << "You are now carrying [src] with one hand." if(unwieldsound) playsound(loc, unwieldsound, 50, 1) var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_held_item() @@ -80,18 +79,20 @@ var/obj/item/weapon/twohanded/offhand/O = new(user) ////Let's reserve his other hand~ O.name = "[name] - offhand" O.desc = "Your second grip on [src]." - O.wielded = TRUE + O.wielded = TRUE user.put_in_inactive_hand(O) return /obj/item/weapon/twohanded/dropped(mob/user) ..() //handles unwielding a twohanded weapon when dropped as well as clearing up the offhand + if(!wielded) + return if(user) var/obj/item/weapon/twohanded/O = user.get_inactive_held_item() if(istype(O)) - O.unwield(user) - return unwield(user) + O.unwield(user, FALSE) + unwield(user) /obj/item/weapon/twohanded/update_icon() return @@ -133,7 +134,7 @@ ///////////Two hand required objects/////////////// //This is for objects that require two hands to even pick up -/obj/item/weapon/twohanded/required/ +/obj/item/weapon/twohanded/required w_class = WEIGHT_CLASS_HUGE /obj/item/weapon/twohanded/required/attack_self() @@ -148,7 +149,7 @@ /obj/item/weapon/twohanded/required/attack_hand(mob/user)//Can't even pick it up without both hands empty var/obj/item/weapon/twohanded/required/H = user.get_inactive_held_item() if(get_dist(src,user) > 1) - return 0 + return if(H != null) user << "[src] is too cumbersome to carry in one hand!" return @@ -163,6 +164,17 @@ else unwield(user) +/obj/item/weapon/twohanded/required/wield(mob/living/carbon/user) + ..() + if(!wielded) + user.unEquip(src) + +/obj/item/weapon/twohanded/required/unwield(mob/living/carbon/user, show_message = TRUE) + if(show_message) + user << "You drop [src]." + ..(user, FALSE) + user.unEquip(src) + /* * Fireaxe */ @@ -290,11 +302,12 @@ if(M.dna.check_mutation(HULK)) M << "You lack the grace to wield this!" return - sharpness = IS_SHARP - w_class = w_class_on ..() - hitsound = 'sound/weapons/blade1.ogg' - START_PROCESSING(SSobj, src) + if(wielded) + sharpness = IS_SHARP + w_class = w_class_on + hitsound = 'sound/weapons/blade1.ogg' + START_PROCESSING(SSobj, src) /obj/item/weapon/twohanded/dualsaber/unwield() //Specific unwield () to switch hitsounds. sharpness = initial(sharpness) diff --git a/code/game/objects/structures/flora.dm b/code/game/objects/structures/flora.dm index e3f96c857da..c935a48f76f 100644 --- a/code/game/objects/structures/flora.dm +++ b/code/game/objects/structures/flora.dm @@ -252,6 +252,7 @@ var/image/I = image(icon = 'icons/obj/flora/plants.dmi' , icon_state = src.icon_state, loc = user) I.override = 1 user.add_alt_appearance("sneaking_mission", I, player_list) + ..() /obj/item/weapon/twohanded/required/kirbyplants/dropped(mob/living/user) ..() diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 08b17ec5ddb..348930b4717 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -8,7 +8,7 @@ -/obj/item/weapon/twohanded/required/ctf +/obj/item/weapon/twohanded/ctf name = "banner" icon = 'icons/obj/items.dmi' icon_state = "banner" @@ -27,22 +27,22 @@ var/obj/effect/ctf/flag_reset/reset var/reset_path = /obj/effect/ctf/flag_reset -/obj/item/weapon/twohanded/required/ctf/New() +/obj/item/weapon/twohanded/ctf/New() ..() if(!reset) reset = new reset_path(get_turf(src)) -/obj/item/weapon/twohanded/required/ctf/Destroy() +/obj/item/weapon/twohanded/ctf/Destroy() if(reset) qdel(reset) reset = null . = ..() -/obj/item/weapon/twohanded/required/ctf/initialize() +/obj/item/weapon/twohanded/ctf/initialize() if(!reset) reset = new reset_path(get_turf(src)) -/obj/item/weapon/twohanded/required/ctf/process() +/obj/item/weapon/twohanded/ctf/process() if(world.time > reset_cooldown) forceMove(get_turf(src.reset)) for(var/mob/M in player_list) @@ -52,7 +52,7 @@ to base!" STOP_PROCESSING(SSobj, src) -/obj/item/weapon/twohanded/required/ctf/attack_hand(mob/living/user) +/obj/item/weapon/twohanded/ctf/attack_hand(mob/living/user) if(!user) return if(team in user.faction) @@ -72,7 +72,7 @@ M << "\The [src] has been taken!" STOP_PROCESSING(SSobj, src) -/obj/item/weapon/twohanded/required/ctf/dropped(mob/user) +/obj/item/weapon/twohanded/ctf/dropped(mob/user) ..() reset_cooldown = world.time + 200 //20 seconds START_PROCESSING(SSobj, src) @@ -83,7 +83,7 @@ anchored = TRUE -/obj/item/weapon/twohanded/required/ctf/red +/obj/item/weapon/twohanded/ctf/red name = "red flag" icon_state = "banner-red" item_state = "banner-red" @@ -92,7 +92,7 @@ reset_path = /obj/effect/ctf/flag_reset/red -/obj/item/weapon/twohanded/required/ctf/blue +/obj/item/weapon/twohanded/ctf/blue name = "blue flag" icon_state = "banner-blue" item_state = "banner-blue" @@ -155,7 +155,7 @@ /obj/machinery, /obj/structure, /obj/effect/ctf, - /obj/item/weapon/twohanded/required/ctf + /obj/item/weapon/twohanded/ctf )) poi_list |= src @@ -248,8 +248,8 @@ attack_ghost(ghost) /obj/machinery/capture_the_flag/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/weapon/twohanded/required/ctf)) - var/obj/item/weapon/twohanded/required/ctf/flag = I + if(istype(I, /obj/item/weapon/twohanded/ctf)) + var/obj/item/weapon/twohanded/ctf/flag = I if(flag.team != src.team) user.unEquip(flag) flag.loc = get_turf(flag.reset) @@ -267,7 +267,7 @@ if(istype(mob_area, /area/ctf)) M << "[team] team wins!" M << "The game has been reset! Teams have been cleared. The machines will be active again in 30 seconds." - for(var/obj/item/weapon/twohanded/required/ctf/W in M) + for(var/obj/item/weapon/twohanded/ctf/W in M) M.unEquip(W) M.dust() for(var/obj/machinery/control_point/control in machines)