From 461cd2b04263f5e11419cd8a6097770b6e07b4b7 Mon Sep 17 00:00:00 2001 From: Dip Date: Fri, 2 Oct 2020 19:46:12 -0300 Subject: [PATCH] getting micro to work again --- code/datums/elements/mob_holder.dm | 5 +- code/modules/mob/living/carbon/human/human.dm | 1 + .../elements}/holder_micro.dm | 135 +++++++++--------- tgstation.dme | 2 +- 4 files changed, 67 insertions(+), 76 deletions(-) rename hyperstation/code/{modules/resize => datums/elements}/holder_micro.dm (69%) diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm index 1cd57f6e..c1a475ac 100644 --- a/code/datums/elements/mob_holder.dm +++ b/code/datums/elements/mob_holder.dm @@ -1,5 +1,5 @@ /datum/element/mob_holder - element_flags = ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH id_arg_index = 2 var/worn_state var/alt_worn @@ -54,9 +54,6 @@ "[user] picks you up!") to_chat(user, "You pick [source] up.") source.drop_all_held_items() - if(ishuman(source)) //Slightly hacky edit to at least not disable the micro holding system entirely - var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) - return holder var/obj/item/clothing/head/mob_holder/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) if(proctype) INVOKE_ASYNC(src, proctype, source, holder, user) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 65259212..405152fd 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -40,6 +40,7 @@ . = ..() if(!CONFIG_GET(flag/disable_human_mood)) AddComponent(/datum/component/mood) + AddElement(/datum/element/mob_holder/micro, "micro") /mob/living/carbon/human/Destroy() QDEL_NULL(physiology) diff --git a/hyperstation/code/modules/resize/holder_micro.dm b/hyperstation/code/datums/elements/holder_micro.dm similarity index 69% rename from hyperstation/code/modules/resize/holder_micro.dm rename to hyperstation/code/datums/elements/holder_micro.dm index 5654a8da..84940bcc 100644 --- a/hyperstation/code/modules/resize/holder_micro.dm +++ b/hyperstation/code/datums/elements/holder_micro.dm @@ -1,4 +1,66 @@ -// Micro Holders - Extends /obj/item/holder... TO:DO, just use most of the already-set procs in inhand_holder.dm +/datum/element/mob_holder/micro + +/datum/element/mob_holder/micro/Attach(datum/target, _worn_state, _alt_worn, _right_hand, _left_hand, _inv_slots = NONE, _proctype) + . = ..() + + if(!isliving(target)) + return ELEMENT_INCOMPATIBLE + + worn_state = _worn_state + alt_worn = _alt_worn + right_hand = _right_hand + left_hand = _left_hand + inv_slots = _inv_slots + proctype = _proctype + + RegisterSignal(target, COMSIG_CLICK_ALT, .proc/mob_try_pickup_micro, override = TRUE) + RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_examine, override = TRUE) + +/datum/element/mob_holder/micro/proc/mob_pickup_micro(mob/living/source, mob/user) + var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) + if(!holder) + return + user.put_in_hands(holder) + return + +//shoehorned (get it?) and lazy way to do instant foot pickups cause haha funny. +/datum/element/mob_holder/micro/proc/mob_pickup_micro_feet(mob/living/source, mob/user) + var/obj/item/clothing/head/mob_holder/micro/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, inv_slots) + if(!holder) + return + user.equip_to_slot(holder, SLOT_SHOES) + return + +/datum/element/mob_holder/micro/proc/mob_try_pickup_micro(mob/living/source, mob/user) + if(!ishuman(user) || !user.Adjacent(source) || user.incapacitated()) + return FALSE + if(abs(user.get_effective_size()/source.get_effective_size()) < 2.0 ) + to_chat(user, "They're too big to pick up!") + return FALSE + if(user.get_active_held_item()) + to_chat(user, "Your hands are full!") + return FALSE + if(source.buckled) + to_chat(user, "[source] is buckled to something!") + return FALSE + if(source == user) + to_chat(user, "You can't pick yourself up.") + return FALSE + source.visible_message("[user] starts picking up [source].", \ + "[user] starts picking you up!") + var/p = abs(source.get_effective_size()/user.get_effective_size() * 40) //Scale how fast the pickup will be depending on size difference + if(!do_after(user, p, target = source)) + return FALSE + + if(user.get_active_held_item()||source.buckled) + return FALSE + + source.visible_message("[user] picks up [source]!", \ + "[user] picks you up!") + to_chat(user, "You pick [source] up.") + source.drop_all_held_items() + mob_pickup_micro(source, user) + return TRUE /obj/item/clothing/head/mob_holder/micro name = "micro" @@ -33,20 +95,6 @@ if(rh_icon) righthand_file = rh_icon -/* This has no need to exist as default assimilate already got it all covered -/obj/item/clothing/head/mob_holder/micro/proc/assimilate(mob/living/M) - switch(M.mob_size) - if(MOB_SIZE_TINY) - w_class = WEIGHT_CLASS_TINY - if(MOB_SIZE_SMALL) - w_class = WEIGHT_CLASS_SMALL - if(MOB_SIZE_HUMAN) - w_class = WEIGHT_CLASS_BULKY - if(MOB_SIZE_LARGE) - w_class = WEIGHT_CLASS_HUGE -*/ - - /obj/item/clothing/head/mob_holder/micro/Destroy() if(held_mob) release() @@ -75,61 +123,6 @@ visible_message("[src] escapes [L]!") release() -//The following code has been disabled, hopefully temporarily. - HS13 elements update -/* -/mob/living/proc/mob_pickup_micro(mob/living/L) - var/obj/item/clothing/head/mob_holder/micro/holder = generate_mob_holder() - if(!holder) - return - drop_all_held_items() - L.put_in_hands(holder) - return - -//shoehorned (get it?) and lazy way to do instant foot pickups cause haha funny. -/mob/living/proc/mob_pickup_micro_feet(mob/living/L) - var/obj/item/clothing/head/mob_holder/micro/holder = generate_mob_holder() - if(!holder) - return - L.equip_to_slot(holder, SLOT_SHOES) - return - -/mob/living/proc/mob_try_pickup_micro(mob/living/user) - if(!ishuman(user) || !src.Adjacent(user) || user.incapacitated() || !can_be_held) - return FALSE - if(abs(user.get_effective_size()/src.get_effective_size()) < 2.0 ) - to_chat(user, "They're too big to pick up!") - return FALSE - if(user.get_active_held_item()) - to_chat(user, "Your hands are full!") - return FALSE - if(buckled) - to_chat(user, "[src] is buckled to something!") - return FALSE - if(src == user) - to_chat(user, "You can't pick yourself up.") - return FALSE - visible_message("[user] starts picking up [src].", \ - "[user] starts picking you up!") - var/p = abs(src.get_effective_size()/user.get_effective_size() * 40) //Scale how fast the pickup will be depending on size difference - if(!do_after(user, p, target = src)) - return FALSE - - if(user.get_active_held_item()||buckled) - return FALSE - - visible_message("[user] picks up [src]!", \ - "[user] picks you up!") - to_chat(user, "You pick [src] up.") - mob_pickup_micro(user) - return TRUE - -/mob/living/AltClick(mob/user) - . = ..() - if(mob_try_pickup_micro(user)) - return TRUE - -*/ - /obj/item/clothing/head/mob_holder/micro/assume_air(datum/gas_mixture/env) var/atom/location = loc if(!loc) @@ -188,4 +181,4 @@ /obj/item/clothing/head/mob_holder/micro/attacked_by(obj/item/I, mob/living/user) for(var/mob/living/carbon/human/M in contents) - M.attacked_by(I, user) + M.attacked_by(I, user) diff --git a/tgstation.dme b/tgstation.dme index e6d71e20..1f28b6de 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2917,6 +2917,7 @@ #include "code\modules\VR\vr_sleeper.dm" #include "code\modules\zombie\items.dm" #include "code\modules\zombie\organs.dm" +#include "hyperstation\code\datums\elements\holder_micro.dm" #include "hyperstation\code\gamemode\traitor_lewd.dm" #include "hyperstation\code\gamemode\traitor_thief.dm" #include "hyperstation\code\gamemode\werewolf\werewolf.dm" @@ -2931,7 +2932,6 @@ #include "hyperstation\code\modules\crafting\recipes.dm" #include "hyperstation\code\modules\integrated_electronics\input.dm" #include "hyperstation\code\modules\patreon\patreon.dm" -#include "hyperstation\code\modules\resize\holder_micro.dm" #include "hyperstation\code\modules\resize\resizing.dm" #include "hyperstation\code\modules\resize\sizechems.dm" #include "hyperstation\code\modules\resize\sizegun.dm"