diff --git a/code/datums/components/waddling.dm b/code/datums/components/waddling.dm deleted file mode 100644 index 47ca60c8a19..00000000000 --- a/code/datums/components/waddling.dm +++ /dev/null @@ -1,22 +0,0 @@ -/datum/component/waddling - dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS - -/datum/component/waddling/Initialize() - . = ..() - if(!ismovableatom(parent)) - return COMPONENT_INCOMPATIBLE - if(isliving(parent)) - RegisterSignal(parent, list(COMSIG_MOVABLE_MOVED), .proc/LivingWaddle) - else - RegisterSignal(parent, list(COMSIG_MOVABLE_MOVED), .proc/Waddle) - -/datum/component/waddling/proc/LivingWaddle() - var/mob/living/L = parent - if(L.incapacitated() || !(L.mobility_flags & MOBILITY_STAND)) - return - Waddle() - -/datum/component/waddling/proc/Waddle() - animate(parent, pixel_z = 4, time = 0) - animate(pixel_z = 0, transform = turn(matrix(), pick(-12, 0, 12)), time=2) - animate(pixel_z = 0, transform = matrix(), time = 0) diff --git a/code/datums/elements/waddling.dm b/code/datums/elements/waddling.dm new file mode 100644 index 00000000000..0d654e85331 --- /dev/null +++ b/code/datums/elements/waddling.dm @@ -0,0 +1,24 @@ +/datum/element/waddling + +/datum/element/waddling/Attach(datum/target) + . = ..() + if(!ismovableatom(target)) + return ELEMENT_INCOMPATIBLE + if(isliving(target)) + RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/LivingWaddle) + else + RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/Waddle) + +/datum/element/waddling/Detach(datum/source, force) + . = ..() + UnregisterSignal(source, COMSIG_MOVABLE_MOVED) + +/datum/element/waddling/proc/LivingWaddle(mob/living/target) + if(target.incapacitated() || !(target.mobility_flags & MOBILITY_STAND)) + return + Waddle() + +/datum/element/waddling/proc/Waddle(atom/movable/target) + animate(target, pixel_z = 4, time = 0) + animate(target, pixel_z = 0, transform = turn(matrix(), pick(-12, 0, 12)), time=2) + animate(target, pixel_z = 0, transform = matrix(), time = 0) diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index 5e98c877ab6..458bc9b4c1f 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -74,7 +74,6 @@ item_state = "clown_shoes" slowdown = SHOES_SLOWDOWN+1 pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes/clown - var/datum/component/waddle var/enabled_waddle = TRUE /obj/item/clothing/shoes/clown_shoes/Initialize() @@ -85,13 +84,13 @@ . = ..() if(slot == ITEM_SLOT_FEET) if(enabled_waddle) - waddle = user.AddComponent(/datum/component/waddling) + user.AddElement(/datum/element/waddling) if(user.mind && user.mind.assigned_role == "Clown") SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "clownshoes", /datum/mood_event/clownshoes) /obj/item/clothing/shoes/clown_shoes/dropped(mob/user) . = ..() - QDEL_NULL(waddle) + user.RemoveElement(/datum/element/waddling) if(user.mind && user.mind.assigned_role == "Clown") SEND_SIGNAL(user, COMSIG_CLEAR_MOOD_EVENT, "clownshoes") @@ -414,7 +413,7 @@ loot = list( /obj/item/clothing/shoes/cowboy/lizard = 7, /obj/item/clothing/shoes/cowboy/lizard/masterwork = 1) - + /obj/item/clothing/shoes/cookflops desc = "All this talk of antags, greytiding, and griefing... I just wanna grill for god's sake!" name = "grilling sandals" diff --git a/code/modules/mob/living/simple_animal/friendly/penguin.dm b/code/modules/mob/living/simple_animal/friendly/penguin.dm index 620e4d28a26..8376f6741eb 100644 --- a/code/modules/mob/living/simple_animal/friendly/penguin.dm +++ b/code/modules/mob/living/simple_animal/friendly/penguin.dm @@ -23,7 +23,7 @@ /mob/living/simple_animal/pet/penguin/Initialize() . = ..() - AddComponent(/datum/component/waddling) + AddElement(/datum/element/waddling) /mob/living/simple_animal/pet/penguin/emperor name = "Emperor penguin" diff --git a/code/modules/surgery/organs/ears.dm b/code/modules/surgery/organs/ears.dm index 5235cd94704..f31795cea56 100644 --- a/code/modules/surgery/organs/ears.dm +++ b/code/modules/surgery/organs/ears.dm @@ -114,19 +114,18 @@ /obj/item/organ/ears/penguin name = "penguin ears" desc = "The source of a penguin's happy feet." - var/datum/component/waddle /obj/item/organ/ears/penguin/Insert(mob/living/carbon/human/H, special = 0, drop_if_replaced = TRUE) . = ..() if(istype(H)) to_chat(H, "You suddenly feel like you've lost your balance.") - waddle = H.AddComponent(/datum/component/waddling) + H.AddElement(/datum/element/waddling) /obj/item/organ/ears/penguin/Remove(mob/living/carbon/human/H, special = 0) . = ..() if(istype(H)) to_chat(H, "Your sense of balance comes back to you.") - QDEL_NULL(waddle) + H.RemoveElement(/datum/element/waddling) /obj/item/organ/ears/bronze name = "tin ears" diff --git a/code/modules/vehicles/cars/clowncar.dm b/code/modules/vehicles/cars/clowncar.dm index 80d9d39958f..72fea0faea2 100644 --- a/code/modules/vehicles/cars/clowncar.dm +++ b/code/modules/vehicles/cars/clowncar.dm @@ -92,7 +92,7 @@ to_chat(user, "You scramble \the [src]'s child safety lock, and a panel with six colorful buttons appears!") initialize_controller_action_type(/datum/action/vehicle/sealed/RollTheDice, VEHICLE_CONTROL_DRIVE) initialize_controller_action_type(/datum/action/vehicle/sealed/Cannon, VEHICLE_CONTROL_DRIVE) - AddComponent(/datum/component/waddling) + AddElement(/datum/element/waddling) /obj/vehicle/sealed/car/clowncar/Destroy() playsound(src, 'sound/vehicles/clowncar_fart.ogg', 100) diff --git a/tgstation.dme b/tgstation.dme index 22afa4a5c82..4d60850a027 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -428,7 +428,6 @@ #include "code\datums\components\tether.dm" #include "code\datums\components\thermite.dm" #include "code\datums\components\uplink.dm" -#include "code\datums\components\waddling.dm" #include "code\datums\components\wearertargeting.dm" #include "code\datums\components\wet_floor.dm" #include "code\datums\components\crafting\crafting.dm" @@ -521,6 +520,7 @@ #include "code\datums\elements\selfknockback.dm" #include "code\datums\elements\snail_crawl.dm" #include "code\datums\elements\squish.dm" +#include "code\datums\elements\waddling.dm" #include "code\datums\helper_datums\events.dm" #include "code\datums\helper_datums\getrev.dm" #include "code\datums\helper_datums\icon_snapshot.dm"