From 1bb37998eb78a7309d7703cd53f19f93ffb6d07e Mon Sep 17 00:00:00 2001 From: Cameron653 Date: Thu, 8 Feb 2018 15:08:19 -0500 Subject: [PATCH] Makes teshari hide work once more. (#4745) * Makes teshari hide work (+1 squashed commits) Squashed commits: [93fd7b7] Makes teshari hide function correctly oncemore. * Changes the stun check to a method that actually works. * boop~ --- code/modules/mob/living/carbon/human/human.dm | 28 +++++++++++++------ .../mob/living/carbon/human/human_powers.dm | 17 +++++++++++ .../carbon/human/species/station/seromi.dm | 2 +- .../mob/living/carbon/human/update_icons.dm | 4 +++ 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 68ea9b8e72..a8c12ed082 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -2,20 +2,21 @@ name = "unknown" real_name = "unknown" voice_name = "unknown" - icon = 'icons/effects/effects.dmi' //We have an ultra-complex update icons that overlays everything, don't load some stupid random male human + icon = 'icons/effects/effects.dmi' //We have an ultra-complex update icons that overlays everything, don't load some stupid random male human icon_state = "nothing" var/list/hud_list[TOTAL_HUDS] - var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us. + var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us. var/obj/item/weapon/rig/wearing_rig // This is very not good, but it's much much better than calling get_rig() every update_canmove() call. - var/last_push_time //For human_attackhand.dm, keeps track of the last use of disarm + var/last_push_time //For human_attackhand.dm, keeps track of the last use of disarm - var/spitting = 0 //Spitting and spitting related things. Any human based ranged attacks, be it innate or added abilities. - var/spit_projectile = null //Projectile type. - var/spit_name = null //String - var/last_spit = 0 //Timestamp. + var/spitting = 0 //Spitting and spitting related things. Any human based ranged attacks, be it innate or added abilities. + var/spit_projectile = null //Projectile type. + var/spit_name = null //String + var/last_spit = 0 //Timestamp. - var/can_defib = 1 //Horrible damage (like beheadings) will prevent defibbing organics. + var/can_defib = 1 //Horrible damage (like beheadings) will prevent defibbing organics. + var/hiding = 0 // If the mob is hiding or not. Makes them appear under tables and the like. /mob/living/carbon/human/New(var/new_loc, var/new_species = null) @@ -1077,7 +1078,7 @@ var/self = 0 if(usr.stat || usr.restrained() || !isliving(usr)) return - + var/datum/gender/TU = gender_datums[usr.get_visible_gender()] var/datum/gender/T = gender_datums[get_visible_gender()] @@ -1536,3 +1537,12 @@ var/obj/item/clothing/accessory/permit/drone/permit = new(T) permit.set_name(real_name) equip_to_appropriate_slot(permit) // If for some reason it can't find room, it'll still be on the floor. + +/mob/living/carbon/human/proc/update_icon_special() //For things such as teshari hiding and whatnot. + if(hiding) // Hiding? Carry on. + if(stat == DEAD || paralysis || weakened || stunned) //stunned/knocked down by something that isn't the rest verb? Note: This was tried with INCAPACITATION_STUNNED, but that refused to work. + hiding = 0 //No hiding for you. Mob layer should be updated naturally, but it actually doesn't. + else + layer = 2.45 + else //Replace this else with other variables if added in the future. Alternatively, could make other things effect this hiding variable. + return diff --git a/code/modules/mob/living/carbon/human/human_powers.dm b/code/modules/mob/living/carbon/human/human_powers.dm index 909b2776d7..f1ece7f6e7 100644 --- a/code/modules/mob/living/carbon/human/human_powers.dm +++ b/code/modules/mob/living/carbon/human/human_powers.dm @@ -265,3 +265,20 @@ organ_data["descriptor"] = O.name to_chat(src, "You feel a slithering sensation as your [O.name] reform.") update_icons_all() + +/mob/living/carbon/human/proc/hide_humanoid() + set name = "Hide" + set desc = "Allows to hide beneath tables or certain items. Toggled on or off." + set category = "Abilities" + + if(stat == DEAD || paralysis || weakened || stunned) // No hiding if you're stunned! + return + + if (!hiding) + layer = 2.45 //Just above cables with their 2.44 + hiding = 1 + to_chat(src, "You are now hiding.") + else + layer = MOB_LAYER + hiding = 0 + to_chat(src, "You have stopped hiding.") \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/species/station/seromi.dm b/code/modules/mob/living/carbon/human/species/station/seromi.dm index 17305be9e8..2e83d47fbe 100644 --- a/code/modules/mob/living/carbon/human/species/station/seromi.dm +++ b/code/modules/mob/living/carbon/human/species/station/seromi.dm @@ -114,7 +114,7 @@ inherent_verbs = list( /mob/living/carbon/human/proc/sonar_ping, - /mob/living/proc/hide + /mob/living/carbon/human/proc/hide_humanoid ) /datum/species/teshari/equip_survival_gear(var/mob/living/carbon/human/H) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 24ec668a94..339f9c1051 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -178,6 +178,9 @@ Please contact me on #coderbus IRC. ~Carn x //5: Set appearance once appearance = ma_compiled + //6: Do any species specific layering updates, such as when hiding. + update_icon_special() + /mob/living/carbon/human/update_transform(var/mutable_appearance/passed_ma) if(QDESTROYING(src)) return @@ -211,6 +214,7 @@ Please contact me on #coderbus IRC. ~Carn x M.Translate(0, 16*(desired_scale-1)) ma.transform = M ma.layer = MOB_LAYER // Fix for a byond bug where turf entry order no longer matters + update_icon_special() //Adjust their layer, like when they are hiding. if(!passed_ma) appearance = ma