From d13d8dd95398f574297fa37e842a822eec2934ff Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 4 Feb 2020 02:13:11 +0100
Subject: [PATCH] Less hacky.
---
code/controllers/subsystem/pai.dm | 1 -
code/datums/elements/mob_holder.dm | 13 ++++++-------
code/modules/mob/living/carbon/monkey/monkey.dm | 2 +-
code/modules/mob/living/silicon/pai/pai_shell.dm | 11 +++++------
.../mob/living/simple_animal/friendly/lizard.dm | 2 +-
5 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/code/controllers/subsystem/pai.dm b/code/controllers/subsystem/pai.dm
index 7fc6f3b7c7..dd9848e465 100644
--- a/code/controllers/subsystem/pai.dm
+++ b/code/controllers/subsystem/pai.dm
@@ -7,7 +7,6 @@ SUBSYSTEM_DEF(pai)
var/ghost_spam = FALSE
var/spam_delay = 100
var/list/pai_card_list = list()
- var/list/mob_holders_by_chassis = list()
/datum/controller/subsystem/pai/Topic(href, href_list)
if(href_list["download"])
diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm
index 5e1e47013a..af184a6353 100644
--- a/code/datums/elements/mob_holder.dm
+++ b/code/datums/elements/mob_holder.dm
@@ -5,10 +5,10 @@
var/alt_worn
var/right_hand
var/left_hand
- var/can_head
+ var/inv_slots
var/proctype //if present, will be invoked on headwear generation.
-/datum/element/mob_holder/Attach(datum/target, _worn_state, _alt_worn, _right_hand, _left_hand, _can_head = FALSE, _proctype)
+/datum/element/mob_holder/Attach(datum/target, _worn_state, _alt_worn, _right_hand, _left_hand, _inv_slots = NONE, _proctype)
. = ..()
if(!isliving(target))
@@ -18,7 +18,7 @@
alt_worn = _alt_worn
right_hand = _right_hand
left_hand = _left_hand
- can_head = _can_head
+ inv_slots = _inv_slots
proctype = _proctype
RegisterSignal(target, COMSIG_CLICK_ALT, .proc/mob_try_pickup)
@@ -54,7 +54,7 @@
"[user] picks you up!")
to_chat(user, "You pick [src] up.")
source.drop_all_held_items()
- var/obj/item/clothing/head/mob_holder/holder = new(get_turf(source), source, worn_state, alt_worn, right_hand, left_hand, can_head)
+ 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)
user.put_in_hands(holder)
@@ -78,7 +78,7 @@
w_class = WEIGHT_CLASS_BULKY
var/mob/living/held_mob
-/obj/item/clothing/head/mob_holder/Initialize(mapload, mob/living/target, worn_state, alt_worn, right_hand, left_hand, can_head = FALSE)
+/obj/item/clothing/head/mob_holder/Initialize(mapload, mob/living/target, worn_state, alt_worn, right_hand, left_hand, inv_slots = NONE)
. = ..()
if(target)
@@ -93,8 +93,7 @@
lefthand_file = left_hand
if(right_hand)
righthand_file = right_hand
- if(!can_head)
- slot_flags &= ~SLOT_HEAD
+ slot_flags = slots
/obj/item/clothing/head/mob_holder/proc/assimilate(mob/living/target)
target.setDir(SOUTH)
diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm
index 94a50b6806..cd51a4234b 100644
--- a/code/modules/mob/living/carbon/monkey/monkey.dm
+++ b/code/modules/mob/living/carbon/monkey/monkey.dm
@@ -43,7 +43,7 @@
/mob/living/carbon/monkey/ComponentInitialize()
. = ..()
- AddElement(/datum/element/mob_holder, "monkey", null, null, null, TRUE)
+ AddElement(/datum/element/mob_holder, "monkey", null, null, null, SLOT_HEAD)
/mob/living/carbon/monkey/Destroy()
diff --git a/code/modules/mob/living/silicon/pai/pai_shell.dm b/code/modules/mob/living/silicon/pai/pai_shell.dm
index 8aa38169ff..37353e2ed7 100644
--- a/code/modules/mob/living/silicon/pai/pai_shell.dm
+++ b/code/modules/mob/living/silicon/pai/pai_shell.dm
@@ -43,12 +43,6 @@
set_light(0)
icon_state = "[chassis]"
visible_message("[src] folds out its holochassis emitter and forms a holoshell around itself!")
- if(possible_chassis[chassis])
- var/datum/element/mob_holder/ele = SSpai.mob_holders_by_chassis[chassis]
- if(ele)
- current_mob_holder = ele.Attach(src)
- else
- current_mob_holder = SSpai.mob_holders_by_chassis[chassis] = AddElement(/datum/element/mob_holder, chassis, 'icons/mob/pai_item_head.dmi', 'icons/mob/pai_item_rh.dmi', 'icons/mob/pai_item_lh.dmi', TRUE)
holoform = TRUE
/mob/living/silicon/pai/proc/fold_in(force = FALSE)
@@ -104,6 +98,11 @@
dynamic_chassis = choice
resist_a_rest(FALSE, TRUE)
update_icon()
+ if(possible_chassis[chassis])
+ current_mob_holder = AddElement(/datum/element/mob_holder, chassis, 'icons/mob/pai_item_head.dmi', 'icons/mob/pai_item_rh.dmi', 'icons/mob/pai_item_lh.dmi', SLOT_HEAD)
+ else
+ current_mob_holder?.Detach(src)
+ return
to_chat(src, "You switch your holochassis projection composite to [chassis]")
/mob/living/silicon/pai/lay_down()
diff --git a/code/modules/mob/living/simple_animal/friendly/lizard.dm b/code/modules/mob/living/simple_animal/friendly/lizard.dm
index 0918005061..6275256f5a 100644
--- a/code/modules/mob/living/simple_animal/friendly/lizard.dm
+++ b/code/modules/mob/living/simple_animal/friendly/lizard.dm
@@ -26,7 +26,7 @@
/mob/living/simple_animal/hostile/lizard/ComponentInitialize()
. = ..()
- AddElement(/datum/element/mob_holder, "lizard", null, null, null, TRUE) //you can hold lizards now.
+ AddElement(/datum/element/mob_holder, "lizard", null, null, null, SLOT_HEAD) //you can hold lizards now.
/mob/living/simple_animal/hostile/lizard/CanAttack(atom/the_target)//Can we actually attack a possible target?
if(see_invisible < the_target.invisibility)//Target's invisible to us, forget it