From b5425869daf1493bb030cb64859bbde170ab342c Mon Sep 17 00:00:00 2001 From: variableundefined <40092670+variableundefined@users.noreply.github.com> Date: Mon, 5 Nov 2018 21:33:42 +0800 Subject: [PATCH] Most content fixed, except for blob act. --- code/datums/components/squeak.dm | 17 +++++++++++++++++ code/game/atoms.dm | 1 + code/game/objects/items/weapons/clown_items.dm | 3 --- code/modules/recycling/disposal.dm | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index 7691e35ca11..4a2ef8a0289 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -24,6 +24,8 @@ RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/play_squeak_crossed) if(isitem(parent)) RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_HIT_REACT, COMSIG_ITEM_ATTACK_SELF), .proc/play_squeak) + RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip) + RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_drop) if(istype(parent, /obj/item/clothing/shoes)) RegisterSignal(parent, COMSIG_SHOES_STEP_ACTION, .proc/step_squeak) @@ -54,6 +56,12 @@ else steps++ +/datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot) + RegisterSignal(equipper, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, TRUE) + +/datum/component/squeak/proc/on_drop(datum/source, mob/user) + UnregisterSignal(user, COMSIG_MOVABLE_DISPOSING) + /datum/component/squeak/proc/play_squeak_crossed(atom/movable/AM) if(isitem(AM)) var/obj/item/I = AM @@ -65,4 +73,13 @@ return var/atom/current_parent = parent if(isturf(current_parent.loc)) + play_squeak() + +/datum/component/squeak/proc/disposing_react(datum/source, obj/structure/disposalholder/holder, obj/machinery/disposal/source) + //We don't need to worry about unregistering this signal as it will happen for us automaticaly when the holder is qdeleted + RegisterSignal(holder, COMSIG_ATOM_DIR_CHANGE, .proc/holder_dir_change) + +/datum/component/squeak/proc/holder_dir_change(datum/source, old_dir, new_dir) + //If the dir changes it means we're going through a bend in the pipes, let's pretend we bumped the wall + if(old_dir != new_dir) play_squeak() \ No newline at end of file diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 457915756bf..4398229391b 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -150,6 +150,7 @@ //Hook for running code when a dir change occurs /atom/proc/setDir(newdir) + SEND_SIGNAL(src, COMSIG_ATOM_DIR_CHANGE, dir, newdir) dir = newdir /atom/proc/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index 35ca810541a..5854b3db24c 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -27,9 +27,6 @@ . = ..() AddComponent(/datum/component/squeak, honk_sounds, 50) -/obj/item/bikehorn/Crossed() - . = ..() - /obj/item/bikehorn/airhorn name = "air horn" desc = "Damn son, where'd you find this?" diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index f6474c4a16b..d0007ab7266 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -538,6 +538,7 @@ // note AM since can contain mobs or objs for(var/atom/movable/AM in D) AM.loc = src + SEND_SIGNAL(AM, COMSIG_MOVABLE_DISPOSING, src, D) if(istype(AM, /mob/living/carbon/human)) var/mob/living/carbon/human/H = AM if(FAT in H.mutations) // is a human and fat?