From 72ddde2b6e1ef5ea41d48344009988e9efb06287 Mon Sep 17 00:00:00 2001 From: Mwahahahaha Date: Fri, 27 Dec 2019 07:08:59 +0800 Subject: [PATCH] Help Up instead of Shake Up (#7624) Whenever you use help intent on someone who is lying down, you hold out your hand instead. The person lying down can then click on you with help intent to take that hand and be helped up. I also ported over Polaris' code for hoisting yourself up by grabbing onto other people but sets them on fire if you're on fire. I also modified the time it takes to pull yourself up so it's longer than in Polaris. Clicking on the person lying down again, moving away, or getting incapacitated will retract your hand. Clicking on the person helping you up while lying down with harm intent slaps away their hand. Don't be a brute. Teamwork makes the dream work. --- code/modules/mob/living/carbon/carbon.dm | 89 ++++++++++++------- .../mob/living/carbon/carbon_defense.dm | 20 +++++ .../mob/living/carbon/carbon_defines.dm | 6 +- .../living/carbon/human/human_attackhand.dm | 5 ++ html/changelogs/help_me_up.yml | 41 +++++++++ 5 files changed, 129 insertions(+), 32 deletions(-) create mode 100644 html/changelogs/help_me_up.yml diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 78bdec83225..195b183e25c 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -50,11 +50,13 @@ if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8)) germ_level++ + src.help_up_offer = 0 + /mob/living/carbon/relaymove(var/mob/living/user, direction) if((user in contents) && istype(user)) if(user.last_special <= world.time) user.last_special = world.time + 50 - src.visible_message("You hear something rumbling inside [src]'s stomach...") + src.visible_message(span("danger", "You hear something rumbling inside [src]'s stomach...")) var/obj/item/I = user.get_active_hand() if(I && I.force) var/d = rand(round(I.force / 4), I.force) @@ -67,7 +69,7 @@ H.updatehealth() else src.take_organ_damage(d) - user.visible_message("[user] attacks [src]'s stomach wall with the [I.name]!") + user.visible_message(span("danger", "[user] attacks [src]'s stomach wall with the [I.name]!")) playsound(user.loc, 'sound/effects/attackblob.ogg', 50, 1) if(prob(src.getBruteLoss() - 50)) @@ -107,9 +109,9 @@ if(H.bg) to_chat(H, span("danger", "You sense some disturbance to your physical body!")) else - visible_message("[M] [action] [src], but they do not respond... Maybe they have S.S.D?") + visible_message(span("notice", "[M] [action] [src], but they do not respond... Maybe they have S.S.D?")) else if(client && willfully_sleeping) - visible_message("[M] [action] [src] waking [t_him] up!") + visible_message(span("notice", "[M] [action] [src] waking [t_him] up!")) sleeping = 0 willfully_sleeping = 0 @@ -138,17 +140,17 @@ playsound(loc, "sparks", 50, 1, -1) if (shock_damage > 15 || tesla_shock) src.visible_message( - "[src] was shocked by the [source]!", \ - "You feel a powerful shock course through your body!", \ - "You hear a heavy electrical crack." \ + span("warning", "[src] was shocked by the [source]!"), \ + span("danger", "You feel a powerful shock course through your body!"), \ + span("warning", "You hear a heavy electrical crack.") \ ) Stun(10)//This should work for now, more is really silly and makes you lay there forever Weaken(10) else src.visible_message( - "[src] was mildly shocked by the [source].", \ - "You feel a mild shock course through your body.", \ - "You hear a light zapping." \ + span("warning", "[src] was mildly shocked by the [source]."), \ + span("warning", "You feel a mild shock course through your body."), \ + span("warning", "You hear a light zapping.") \ ) spark(loc, 5, alldirs) @@ -163,7 +165,7 @@ if(item_in_hand) //this segment checks if the item in your hand is twohanded. if(istype(item_in_hand,/obj/item/material/twohanded) || istype(item_in_hand,/obj/item/gun) || istype(item_in_hand,/obj/item/pickaxe)) if(item_in_hand:wielded == 1) - to_chat(usr, "Your other hand is too busy holding the [item_in_hand.name]") + to_chat(usr, span("warning", "Your other hand is too busy holding the [item_in_hand.name]")) return src.hand = !( src.hand ) if(hud_used.l_hand_hud_object && hud_used.r_hand_hud_object) @@ -198,7 +200,7 @@ var/mob/living/carbon/human/H = src src.visible_message( \ text("[src] examines [].",src.gender==MALE?"himself":"herself"), \ - "You check yourself for injuries." \ + span("notice", "You check yourself for injuries.") \ ) for(var/obj/item/organ/external/org in H.organs) @@ -243,19 +245,19 @@ else if (on_fire) playsound(src.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) if (M.on_fire) - M.visible_message("[M] tries to pat out [src]'s flames, but to no avail!", - "You try to pat out [src]'s flames, but to no avail! Put yourself out first!") + M.visible_message(span("warning", "[M] tries to pat out [src]'s flames, but to no avail!"), + span("warning", "You try to pat out [src]'s flames, but to no avail! Put yourself out first!")) else - M.visible_message("[M] tries to pat out [src]'s flames!", - "You try to pat out [src]'s flames! Hot!") + M.visible_message(span("warning", "[M] tries to pat out [src]'s flames!"), + span("warning", "You try to pat out [src]'s flames! Hot!")) if(do_mob(M, src, 1.5 SECONDS)) if (M.IgniteMob(prob(10))) - M.visible_message("The fire spreads from [src] to [M]!", - "The fire spreads to you as well!") + M.visible_message(span("danger", "The fire spreads from [src] to [M]!"), + span("danger", "The fire spreads to you as well!")) else if (src.ExtinguishMob(1)) - M.visible_message("[M] successfully pats out [src]'s flames.", - "You successfully pat out [src]'s flames.") + M.visible_message(span("warning", "[M] successfully pats out [src]'s flames."), + span("warning", "You successfully pat out [src]'s flames.")) else var/t_him = "it" if (src.gender == MALE) @@ -275,17 +277,42 @@ if(H.bg) to_chat(H, span("warning", "You sense some disturbance to your physical body, like someone is trying to wake you up.")) else - M.visible_message("[M] shakes [src] trying to wake [t_him] up!", \ - "You shake [src], but they do not respond... Maybe they have S.S.D?") - else if(lying || src.sleeping) - src.sleeping = max(0,src.sleeping-5) - if(src.sleeping == 0) - src.resting = 0 - M.visible_message("[M] shakes [src] trying to wake [t_him] up!", \ - "You shake [src] trying to wake [t_him] up!") + M.visible_message(span("notice", "[M] shakes [src] trying to wake [t_him] up!"), \ + span("notice", "You shake [src], but they do not respond... Maybe they have S.S.D?")) + else if(lying) + if(src.sleeping) + src.sleeping = max(0,src.sleeping-5) + M.visible_message(span("notice", "[M] shakes [src] trying to wake [t_him] up!"), \ + span("notice", "You shake [src] trying to wake [t_him] up!")) + else + M.help_up_offer = !M.help_up_offer + if(M.help_up_offer) + M.visible_message(span("notice", "[M] holds a hand out to [src]."), \ + span("notice", "You hold a hand out to [src].")) + else + M.visible_message(span("warning", "[M] retracts their hand from [src]'s direction."), \ + span("warning", "You retract your hand from [src]'s direction.")) else var/mob/living/carbon/human/tapper = M - if(istype(tapper)) + if(M.resting) + if(src.help_up_offer) + M.visible_message(span("notice", "[M] grabs onto [src]'s hand and is hoisted up."), \ + span("notice", "You grab onto [src]'s hand and are hoisted up.")) + if(do_after(M, 0.5 SECONDS)) + M.resting = 0 + src.help_up_offer = 0 + else + M.visible_message(span("warning", "[M] grabs onto [src], trying to pull themselves up."), \ + span("warning", "You grab onto [src], trying to pull yourself up.")) + if(M.fire_stacks >= (src.fire_stacks + 3)) + src.adjust_fire_stacks(1) + M.adjust_fire_stacks(-1) + if(M.on_fire) + src.IgniteMob() + if(do_after(M, 4 SECONDS)) + M.resting = 0 + + else if(istype(tapper)) tapper.species.tap(tapper,src) else M.visible_message("[M] taps [src] to get their attention!", \ @@ -370,7 +397,7 @@ set category = "IC" if(usr.sleeping) - to_chat(usr, "You are already sleeping") + to_chat(usr, span("warning", "You are already sleeping")) return if(alert(src,"You sure you want to sleep for a while?","Sleep","Yes","No") == "Yes") willfully_sleeping = 1 @@ -390,7 +417,7 @@ if(buckled) return 0 stop_pulling() - to_chat(src, "You slipped on [slipped_on]!") + to_chat(src, span("warning", "You slipped on [slipped_on]!")) playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) Stun(stun_duration) Weaken(Floor(stun_duration/2)) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index a662743d43d..d33521734ba 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -187,3 +187,23 @@ src.attack_log += "\[[time_stamp()]\] Got knifed by [user.name] ([user.ckey]) with [W.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(W.damtype)])" msg_admin_attack("[key_name_admin(user)] knifed [key_name_admin(src)] with [W.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(W.damtype)])",ckey=key_name(user),ckey_target=key_name(src) ) return 1 + +/mob/living/carbon/Stun(amount) + help_up_offer = 0 + ..() + +/mob/living/carbon/Weaken(amount) + help_up_offer = 0 + ..() + +/mob/living/carbon/Paralyse(amount) + help_up_offer = 0 + ..() + +/mob/living/carbon/Sleeping(amount) + help_up_offer = 0 + ..() + +/mob/living/carbon/Resting(amount) + help_up_offer = 0 + ..() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index 16dfddbd6c2..1108c341ac0 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -33,5 +33,9 @@ var/willfully_sleeping = 0 var/consume_nutrition_from_air = FALSE // used by Diona + + var/help_up_offer = 0 //if they have their hand out to offer someone up from the ground. + var/list/organs_by_name = list() // map organ names to organs - var/list/internal_organs_by_name = list() // so internal organs have less ickiness too \ No newline at end of file + var/list/internal_organs_by_name = list() // so internal organs have less ickiness too + diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 69c2367b3a2..32ccb8be91e 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -352,6 +352,11 @@ // Finally, apply damage to target apply_damage(real_damage, hit_dam_type, hit_zone, armour, sharp=is_sharp, edge=is_edge) + + if(M.resting && src.help_up_offer) + M.visible_message(span("warning", "[M] slaps away [src]'s hand!")) + src.help_up_offer = 0 + if(I_DISARM) var/disarm_cost var/usesStamina diff --git a/html/changelogs/help_me_up.yml b/html/changelogs/help_me_up.yml new file mode 100644 index 00000000000..ad40680f596 --- /dev/null +++ b/html/changelogs/help_me_up.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: Mwahahahaha + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Shaking people on the floor now has you offer a hand out to them like a true civilised person. The person on the floor must click on that civilised person with help intent to be helped up."