Less hacky.

This commit is contained in:
Ghommie
2020-02-04 02:13:11 +01:00
parent 63c8612ccd
commit d13d8dd953
5 changed files with 13 additions and 16 deletions
-1
View File
@@ -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"])
+6 -7
View File
@@ -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 @@
"<span class='userdanger'>[user] picks you up!</span>")
to_chat(user, "<span class='notice'>You pick [src] up.</span>")
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)
@@ -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()
@@ -43,12 +43,6 @@
set_light(0)
icon_state = "[chassis]"
visible_message("<span class='boldnotice'>[src] folds out its holochassis emitter and forms a holoshell around itself!</span>")
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, "<span class='boldnotice'>You switch your holochassis projection composite to [chassis]</span>")
/mob/living/silicon/pai/lay_down()
@@ -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