Merge pull request #545 from ArchieBeepBoop/mobholders

Mob_holder and examine microopt
This commit is contained in:
Dahlular
2020-10-04 03:11:32 -06:00
committed by GitHub
2 changed files with 19 additions and 22 deletions
+9 -11
View File
@@ -94,7 +94,7 @@
lefthand_file = left_hand
if(right_hand)
righthand_file = right_hand
slot_flags = slots
slot_flags = slots
/obj/item/clothing/head/mob_holder/proc/assimilate(mob/living/target)
target.setDir(SOUTH)
@@ -102,6 +102,8 @@
target.forceMove(src)
var/image/I = new //work around to retain the same appearance to the mob idependently from inhands/worn states.
I.appearance = target.appearance
I.layer = FLOAT_LAYER //So it doesn't get screwed up by layer overrides.
I.plane = FLOAT_PLANE //Same as above but for planes.
I.override = TRUE
add_overlay(I)
name = target.name
@@ -111,27 +113,23 @@
w_class = WEIGHT_CLASS_TINY
if(MOB_SIZE_SMALL)
w_class = WEIGHT_CLASS_NORMAL
if(MOB_SIZE_HUMAN)
w_class = WEIGHT_CLASS_BULKY
if(MOB_SIZE_LARGE)
w_class = WEIGHT_CLASS_HUGE
RegisterSignal(src, COMSIG_CLICK_SHIFT, .proc/examine_held_mob, override = TRUE)
/obj/item/clothing/head/mob_holder/Destroy()
if(held_mob)
release()
return ..()
/obj/item/clothing/head/mob_holder/proc/examine_held_mob(datum/source, mob/user)
held_mob.ShiftClick(user)
return COMPONENT_DENY_EXAMINATE
/obj/item/clothing/head/mob_holder/examine(mob/user)
return held_mob?.examine(user) || ..()
/obj/item/clothing/head/mob_holder/Exited(atom/movable/AM, atom/newloc)
. = ..()
if(AM == held_mob)
held_mob.reset_perspective()
held_mob = null
qdel(src)
QDEL_IN(src, 1) //To avoid a qdel loop.
/obj/item/clothing/head/mob_holder/Entered(atom/movable/AM, atom/newloc)
. = ..()
@@ -161,7 +159,7 @@
/obj/item/clothing/head/mob_holder/container_resist()
if(isliving(loc))
var/mob/living/L = loc
L.visible_message("<span class='warning'>[src] escapes from [L]!</span>", "<span class='warning'>[src] escapes your grip!</span>")
L.visible_message("<span class='warning'>[held_mob] escapes from [L]!</span>", "<span class='warning'>[held_mob] escapes your grip!</span>")
release()
/obj/item/clothing/head/mob_holder/assume_air(datum/gas_mixture/env)
@@ -173,7 +171,7 @@
location = location.loc
if(ismob(location))
return location.loc.assume_air(env)
return loc.assume_air(env)
return location.assume_air(env)
/obj/item/clothing/head/mob_holder/remove_air(amount)
var/atom/location = loc
@@ -184,4 +182,4 @@
location = location.loc
if(ismob(location))
return location.loc.remove_air(amount)
return loc.remove_air(amount)
return location.remove_air(amount)