From 199feff17d9bed8bacb952c25b4407796e77b7eb Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 15 May 2023 00:05:27 +0100 Subject: [PATCH] [MIRROR] [no gbp] Golem mineral functionality tweaks/fixes [MDB IGNORE] (#21121) * [no gbp] Golem mineral functionality tweaks/fixes (#75343) ## About The Pull Request Fixes a couple of things people have pointed out about golem transformations. - Diamond golems now stop being invisible when they attack or throw something, they also turn invisible a bit slower. - Using a bluespace knot takes 2 seconds instead of 3 seconds. - Bananium Golems only slip you if they are lying down. In order to achieve that last one I refactored the slipperiness component to take an optional extra callback, and then killed a subtype of it which could be replaced with passing in a callback. I tested it and it seems to work the same as it used to. These are largely how things were supposed to work and I just overlooked them. I am sure this won't be the last PR of a similar vein while people try these out, provided that I actually hear anything they are saying about it. ## Why It's Good For The Game Diamond golems shouldn't be able to attack you while remaining invisible and untargetable even if it is funny. Clown golems aren't supposed to be able to slip you by swapping places with you even if it is funny. The bluespace hand was basically just worse than using the crystal and not eating it, maybe still needs another buff after this one. ## Changelog :cl: fix: Diamond Golems can no longer attack or throw things and remain invisible. fix: Bananium Golems are only slippery if you actually tread on them (aka: while they are resting). balance: Golem bluespace teleportation is slightly quicker. /:cl: --------- Co-authored-by: san7890 * [no gbp] Golem mineral functionality tweaks/fixes --------- Co-authored-by: Jacquerel Co-authored-by: san7890 --- code/datums/components/slippery.dm | 54 ++++++++++++------- .../stacks/golem_food/golem_hand_actions.dm | 2 +- .../stacks/golem_food/golem_status_effects.dm | 21 +++++--- .../computers/item/role_tablet_presets.dm | 16 +++++- 4 files changed, 66 insertions(+), 27 deletions(-) diff --git a/code/datums/components/slippery.dm b/code/datums/components/slippery.dm index ce9c80c5d34..20840ba1704 100644 --- a/code/datums/components/slippery.dm +++ b/code/datums/components/slippery.dm @@ -9,8 +9,10 @@ var/paralyze_time = 0 /// Flags for how slippery the parent is. See [__DEFINES/mobs.dm] var/lube_flags + /// Optional callback providing an additional chance to prevent slippage + var/datum/callback/can_slip_callback /// A proc callback to call on slip. - var/datum/callback/callback + var/datum/callback/on_slip_callback /// If parent is an item, this is the person currently holding/wearing the parent (or the parent if no one is holding it) var/mob/living/holder /// Whitelist of item slots the parent can be equipped in that make the holder slippery. If null or empty, it will always make the holder slippery. @@ -28,12 +30,21 @@ /// The connect_loc_behalf component for the holder_connections list. var/datum/weakref/holder_connect_loc_behalf -/datum/component/slippery/Initialize(knockdown, lube_flags = NONE, datum/callback/callback, paralyze, force_drop = FALSE, slot_whitelist) +/datum/component/slippery/Initialize( + knockdown, + lube_flags = NONE, + datum/callback/on_slip_callback, + paralyze, + force_drop = FALSE, + slot_whitelist, + datum/callback/can_slip_callback, +) src.knockdown_time = max(knockdown, 0) src.paralyze_time = max(paralyze, 0) src.force_drop_items = force_drop src.lube_flags = lube_flags - src.callback = callback + src.can_slip_callback = can_slip_callback + src.on_slip_callback = on_slip_callback if(slot_whitelist) src.slot_whitelist = slot_whitelist @@ -49,11 +60,22 @@ if(ismovable(parent)) AddComponent(/datum/component/connect_loc_behalf, parent, default_connections) -/datum/component/slippery/InheritComponent(datum/component/slippery/component, i_am_original, knockdown, lube_flags = NONE, datum/callback/callback, paralyze, force_drop = FALSE, slot_whitelist) +/datum/component/slippery/InheritComponent( + datum/component/slippery/component, + i_am_original, + knockdown, + lube_flags = NONE, + datum/callback/on_slip_callback, + paralyze, + force_drop = FALSE, + slot_whitelist, + datum/callback/can_slip_callback, +) if(component) knockdown = component.knockdown_time lube_flags = component.lube_flags - callback = component.callback + on_slip_callback = component.on_slip_callback + can_slip_callback = component.on_slip_callback paralyze = component.paralyze_time force_drop = component.force_drop_items slot_whitelist = component.slot_whitelist @@ -62,7 +84,8 @@ src.paralyze_time = max(paralyze, 0) src.force_drop_items = force_drop src.lube_flags = lube_flags - src.callback = callback + src.on_slip_callback = on_slip_callback + src.can_slip_callback = can_slip_callback if(slot_whitelist) src.slot_whitelist = slot_whitelist /* @@ -76,8 +99,12 @@ if(!isliving(arrived)) return var/mob/living/victim = arrived - if(!(victim.movement_type & (FLYING | FLOATING)) && victim.slip(knockdown_time, parent, lube_flags, paralyze_time, force_drop_items) && callback) - callback.Invoke(victim) + if((victim.movement_type & (FLYING | FLOATING))) + return + if(can_slip_callback && !can_slip_callback.Invoke(holder, victim)) + return + if(victim.slip(knockdown_time, parent, lube_flags, paralyze_time, force_drop_items)) + on_slip_callback?.Invoke(victim) /* * Gets called when COMSIG_ITEM_EQUIPPED is sent to parent. @@ -143,14 +170,3 @@ /datum/component/slippery/UnregisterFromParent() . = ..() qdel(GetComponent(/datum/component/connect_loc_behalf)) - -/// Used for making the clown PDA only slip if the clown is wearing his shoes and the elusive banana-skin belt -/datum/component/slippery/clowning - -/datum/component/slippery/clowning/Slip_on_wearer(datum/source, atom/movable/AM) - var/obj/item/I = holder.get_item_by_slot(ITEM_SLOT_FEET) - if(holder.body_position == LYING_DOWN && !holder.buckled) - if(istype(I, /obj/item/clothing/shoes/clown_shoes)) - Slip(source, AM) - else - to_chat(holder,span_warning("[parent] failed to slip anyone. Perhaps I shouldn't have abandoned my legacy...")) diff --git a/code/game/objects/items/stacks/golem_food/golem_hand_actions.dm b/code/game/objects/items/stacks/golem_food/golem_hand_actions.dm index 97165b18355..fc87d094477 100644 --- a/code/game/objects/items/stacks/golem_food/golem_hand_actions.dm +++ b/code/game/objects/items/stacks/golem_food/golem_hand_actions.dm @@ -65,7 +65,7 @@ /// How far away can you point? var/teleport_range = 7 /// How long does it take to teleport? - var/teleport_time = 3 SECONDS + var/teleport_time = 2 SECONDS /// How accurate are you? var/teleport_vary = 2 diff --git a/code/game/objects/items/stacks/golem_food/golem_status_effects.dm b/code/game/objects/items/stacks/golem_food/golem_status_effects.dm index 03c7af2dc12..f6ebd7ef7d2 100644 --- a/code/game/objects/items/stacks/golem_food/golem_status_effects.dm +++ b/code/game/objects/items/stacks/golem_food/golem_status_effects.dm @@ -260,9 +260,9 @@ alert_icon_state = "sheet-diamond" alert_desc = "Light is bending around you, making you hard to see while still and faster while moving." /// Alpha to remove per second while stood still - var/alpha_per_tick = 25 + var/alpha_per_tick = 20 /// Alpha to apply while moving - var/moving_alpha = 150 + var/moving_alpha = 200 /// List of arms we have updated var/list/modified_arms @@ -270,7 +270,7 @@ . = ..() if (!.) return FALSE - RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(on_move)) + RegisterSignals(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_MOB_THROW, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_ITEM_ATTACK), PROC_REF(on_reveal)) owner.alpha = moving_alpha owner.add_movespeed_modifier(/datum/movespeed_modifier/status_effect/light_speed) @@ -285,7 +285,7 @@ owner.alpha = max(owner.alpha - alpha_per_tick, 0) /// Reset alpha to starting value -/datum/status_effect/golem/diamond/proc/on_move() +/datum/status_effect/golem/diamond/proc/on_reveal() SIGNAL_HANDLER owner.alpha = moving_alpha @@ -301,7 +301,7 @@ /datum/status_effect/golem/diamond/on_remove() owner.alpha = initial(owner.alpha) owner.remove_movespeed_modifier(/datum/movespeed_modifier/status_effect/light_speed) - UnregisterSignal(owner, COMSIG_MOVABLE_MOVED) + UnregisterSignal(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_MOB_THROW, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_ITEM_ATTACK)) for (var/obj/item/bodypart/arm/arm as anything in modified_arms) reset_arm_fluff(arm) LAZYCLEARLIST(modified_arms) @@ -407,7 +407,16 @@ return owner.AddElement(/datum/element/waddling) ADD_TRAIT(owner, TRAIT_NO_SLIP_WATER, TRAIT_STATUS_EFFECT(id)) - slipperiness = owner.AddComponent(/datum/component/slippery, knockdown = 12 SECONDS, lube_flags = NO_SLIP_WHEN_WALKING) + slipperiness = owner.AddComponent(\ + /datum/component/slippery,\ + knockdown = 12 SECONDS,\ + lube_flags = NO_SLIP_WHEN_WALKING,\ + can_slip_callback = CALLBACK(src, PROC_REF(try_slip)),\ + ) + +/// Only slip people when we're down on the ground +/datum/status_effect/golem/bananium/proc/try_slip(mob/living/slipper, mob/living/slippee) + return owner.body_position == LYING_DOWN /datum/status_effect/golem/bananium/on_remove() REMOVE_TRAIT(owner, TRAIT_NO_SLIP_WATER, TRAIT_STATUS_EFFECT(id)) diff --git a/code/modules/modular_computers/computers/item/role_tablet_presets.dm b/code/modules/modular_computers/computers/item/role_tablet_presets.dm index ea76760c88a..ed4fd0f9408 100644 --- a/code/modules/modular_computers/computers/item/role_tablet_presets.dm +++ b/code/modules/modular_computers/computers/item/role_tablet_presets.dm @@ -312,9 +312,23 @@ /obj/item/modular_computer/pda/clown/Initialize(mapload) . = ..() - AddComponent(/datum/component/slippery/clowning, 120, NO_SLIP_WHEN_WALKING, CALLBACK(src, PROC_REF(AfterSlip)), slot_whitelist = list(ITEM_SLOT_ID, ITEM_SLOT_BELT)) + AddComponent(\ + /datum/component/slippery,\ + knockdown = 12 SECONDS,\ + lube_flags = NO_SLIP_WHEN_WALKING,\ + on_slip_callback = CALLBACK(src, PROC_REF(AfterSlip)),\ + can_slip_callback = CALLBACK(src, PROC_REF(try_slip)),\ + slot_whitelist = list(ITEM_SLOT_ID, ITEM_SLOT_BELT),\ + ) AddComponent(/datum/component/wearertargeting/sitcomlaughter, CALLBACK(src, PROC_REF(after_sitcom_laugh))) +/// Return true if our wearer is in a position to slip someone +/obj/item/modular_computer/pda/clown/proc/try_slip(mob/living/slipper, mob/living/slippee) + if(!istype(slipper.get_item_by_slot(ITEM_SLOT_FEET), /obj/item/clothing/shoes/clown_shoes)) + to_chat(slipper,span_warning("[src] failed to slip anyone. Perhaps I shouldn't have abandoned my legacy...")) + return FALSE + return TRUE + /obj/item/modular_computer/pda/clown/update_overlays() . = ..() . += mutable_appearance(icon, "pda_stripe_clown") // clowns have eyes that go over their screen, so it needs to be compiled last