mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-26 10:04:12 +00:00
Merge pull request #1191 from Kelenius/inventoryCleanup
Mob inventory cleanup
This commit is contained in:
@@ -1,43 +1,3 @@
|
||||
//This proc is called whenever someone clicks an inventory ui slot.
|
||||
/mob/proc/attack_ui(slot)
|
||||
var/obj/item/W = get_active_hand()
|
||||
if(istype(W))
|
||||
equip_to_slot_if_possible(W, slot)
|
||||
|
||||
/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1, redraw_mob = 1)
|
||||
if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning, redraw_mob))
|
||||
return 1
|
||||
else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning, redraw_mob))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//This is a SAFE proc. Use this instead of equip_to_slot()!
|
||||
//set del_on_fail to have it delete W if it fails to equip
|
||||
//set disable_warning to disable the 'you are unable to equip that' warning.
|
||||
//unset redraw_mob to prevent the mob from being redrawn at the end.
|
||||
/mob/proc/equip_to_slot_if_possible(obj/item/W as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1)
|
||||
if(!istype(W)) return 0
|
||||
|
||||
if(!W.mob_can_equip(src, slot))
|
||||
if(del_on_fail)
|
||||
qdel(W)
|
||||
else
|
||||
if(!disable_warning)
|
||||
src << "\red You are unable to equip that." //Only print if del_on_fail is false
|
||||
return 0
|
||||
|
||||
equip_to_slot(W, slot, redraw_mob) //This proc should not ever fail.
|
||||
return 1
|
||||
|
||||
//This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't eqip need to be done before! Use mob_can_equip() for that task.
|
||||
//In most cases you will want to use equip_to_slot_if_possible()
|
||||
/mob/proc/equip_to_slot(obj/item/W as obj, slot)
|
||||
return
|
||||
|
||||
//This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such.
|
||||
/mob/proc/equip_to_slot_or_del(obj/item/W as obj, slot)
|
||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
||||
|
||||
//The list of slots by priority. equip_to_appropriate_slot() uses this list. Doesn't matter if a mob type doesn't have a slot.
|
||||
var/list/slot_equipment_priority = list( \
|
||||
slot_back,\
|
||||
@@ -58,6 +18,49 @@ var/list/slot_equipment_priority = list( \
|
||||
slot_r_store\
|
||||
)
|
||||
|
||||
/mob
|
||||
var/obj/item/weapon/storage/s_active = null // Even ghosts can/should be able to peek into boxes on the ground
|
||||
|
||||
//This proc is called whenever someone clicks an inventory ui slot.
|
||||
/mob/proc/attack_ui(var/slot)
|
||||
var/obj/item/W = get_active_hand()
|
||||
if(istype(W))
|
||||
equip_to_slot_if_possible(W, slot)
|
||||
|
||||
/* Inventory manipulation */
|
||||
|
||||
/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1, redraw_mob = 1)
|
||||
if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning, redraw_mob))
|
||||
return 1
|
||||
else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning, redraw_mob))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//This is a SAFE proc. Use this instead of equip_to_slot()!
|
||||
//set del_on_fail to have it delete W if it fails to equip
|
||||
//set disable_warning to disable the 'you are unable to equip that' warning.
|
||||
//unset redraw_mob to prevent the mob from being redrawn at the end.
|
||||
/mob/proc/equip_to_slot_if_possible(obj/item/W as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1)
|
||||
if(!W.mob_can_equip(src, slot))
|
||||
if(del_on_fail)
|
||||
qdel(W)
|
||||
else
|
||||
if(!disable_warning)
|
||||
src << "\red You are unable to equip that." //Only print if del_on_fail is false
|
||||
return 0
|
||||
|
||||
equip_to_slot(W, slot, redraw_mob) //This proc should not ever fail.
|
||||
return 1
|
||||
|
||||
//This is an UNSAFE proc. It merely handles the actual job of equipping. All the checks on whether you can or can't eqip need to be done before! Use mob_can_equip() for that task.
|
||||
//In most cases you will want to use equip_to_slot_if_possible()
|
||||
/mob/proc/equip_to_slot(obj/item/W as obj, slot)
|
||||
return
|
||||
|
||||
//This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such.
|
||||
/mob/proc/equip_to_slot_or_del(obj/item/W as obj, slot)
|
||||
return equip_to_slot_if_possible(W, slot, 1, 1, 0)
|
||||
|
||||
//Checks if a given slot can be accessed at this time, either to equip or unequip I
|
||||
/mob/proc/slot_is_accessible(var/slot, var/obj/item/I, mob/user=null)
|
||||
return 1
|
||||
@@ -65,8 +68,6 @@ var/list/slot_equipment_priority = list( \
|
||||
//puts the item "W" into an appropriate slot in a human's inventory
|
||||
//returns 0 if it cannot, 1 if successful
|
||||
/mob/proc/equip_to_appropriate_slot(obj/item/W)
|
||||
if(!istype(W)) return 0
|
||||
|
||||
for(var/slot in slot_equipment_priority)
|
||||
if(equip_to_slot_if_possible(W, slot, del_on_fail=0, disable_warning=1, redraw_mob=1))
|
||||
return 1
|
||||
@@ -74,32 +75,15 @@ var/list/slot_equipment_priority = list( \
|
||||
return 0
|
||||
|
||||
/mob/proc/equip_to_storage(obj/item/newitem)
|
||||
// Try put it in their backpack
|
||||
if(istype(src.back,/obj/item/weapon/storage))
|
||||
var/obj/item/weapon/storage/backpack = src.back
|
||||
if(backpack.contents.len < backpack.storage_slots)
|
||||
newitem.forceMove(src.back)
|
||||
return 1
|
||||
|
||||
// Try to place it in any item that can store stuff, on the mob.
|
||||
for(var/obj/item/weapon/storage/S in src.contents)
|
||||
if (S.contents.len < S.storage_slots)
|
||||
newitem.forceMove(S)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//These procs handle putting s tuff in your hand. It's probably best to use these rather than setting l_hand = ...etc
|
||||
//as they handle all relevant stuff like adding it to the player's screen and updating their overlays.
|
||||
/* Hands */
|
||||
|
||||
//Returns the thing in our active hand
|
||||
/mob/proc/get_active_hand()
|
||||
if(hand) return l_hand
|
||||
else return r_hand
|
||||
|
||||
//Returns the thing in our inactive hand
|
||||
/mob/proc/get_inactive_hand()
|
||||
if(hand) return r_hand
|
||||
else return l_hand
|
||||
|
||||
//Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success.
|
||||
/mob/proc/put_in_l_hand(var/obj/item/W)
|
||||
@@ -150,16 +134,15 @@ var/list/slot_equipment_priority = list( \
|
||||
|
||||
//Drops the item in our left hand
|
||||
/mob/proc/drop_l_hand(var/atom/Target)
|
||||
return drop_from_inventory(l_hand, Target)
|
||||
return 0
|
||||
|
||||
//Drops the item in our right hand
|
||||
/mob/proc/drop_r_hand(var/atom/Target)
|
||||
return drop_from_inventory(r_hand, Target)
|
||||
return 0
|
||||
|
||||
//Drops the item in our active hand. TODO: rename this to drop_active_hand or something
|
||||
/mob/proc/drop_item(var/atom/Target)
|
||||
if(hand) return drop_l_hand(Target)
|
||||
else return drop_r_hand(Target)
|
||||
return
|
||||
|
||||
/*
|
||||
Removes the object from any slots the mob might have, calling the appropriate icon update proc.
|
||||
@@ -173,19 +156,6 @@ var/list/slot_equipment_priority = list( \
|
||||
the search through all the slots, without having to duplicate the rest of the item dropping.
|
||||
*/
|
||||
/mob/proc/u_equip(obj/W as obj)
|
||||
if (W == r_hand)
|
||||
r_hand = null
|
||||
update_inv_r_hand(0)
|
||||
else if (W == l_hand)
|
||||
l_hand = null
|
||||
update_inv_l_hand(0)
|
||||
else if (W == back)
|
||||
back = null
|
||||
update_inv_back(0)
|
||||
else if (W == wear_mask)
|
||||
wear_mask = null
|
||||
update_inv_wear_mask(0)
|
||||
return
|
||||
|
||||
/mob/proc/isEquipped(obj/item/I)
|
||||
if(!I)
|
||||
@@ -229,11 +199,6 @@ var/list/slot_equipment_priority = list( \
|
||||
|
||||
//Returns the item equipped to the specified slot, if any.
|
||||
/mob/proc/get_equipped_item(var/slot)
|
||||
switch(slot)
|
||||
if(slot_l_hand) return l_hand
|
||||
if(slot_r_hand) return r_hand
|
||||
if(slot_back) return back
|
||||
if(slot_wear_mask) return wear_mask
|
||||
return null
|
||||
|
||||
//Outdated but still in use apparently. This should at least be a human proc.
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
|
||||
/* Assembly */
|
||||
|
||||
/obj/item/weapon/storage/toolbox/mechanical/attackby(var/obj/item/stack/tile/floor/T, mob/user as mob)
|
||||
/obj/item/weapon/storage/toolbox/mechanical/attackby(var/obj/item/stack/tile/floor/T, mob/living/user as mob)
|
||||
if(!istype(T, /obj/item/stack/tile/floor))
|
||||
..()
|
||||
return
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var/mob/living/carbon/human/H = over_object
|
||||
if(!istype(H) || !Adjacent(H))
|
||||
return ..()
|
||||
if(H.a_intent == "grab" && hat && !(H.l_hand && H.r_hand))
|
||||
if(H.a_intent == "grab" && hat && !H.hands_are_full())
|
||||
hat.loc = get_turf(src)
|
||||
H.put_in_hands(hat)
|
||||
H.visible_message("<span class='danger'>\The [H] removes \the [src]'s [hat].</span>")
|
||||
|
||||
@@ -3,40 +3,40 @@
|
||||
set name = "Give"
|
||||
|
||||
// TODO : Change to incapacitated() on merge.
|
||||
if(usr.stat || usr.lying || usr.resting || usr.buckled)
|
||||
if(src.stat || src.lying || src.resting || src.buckled)
|
||||
return
|
||||
if(!istype(target) || target.stat || target.lying || target.resting || target.buckled || target.client == null)
|
||||
return
|
||||
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
var/obj/item/I = src.get_active_hand()
|
||||
if(!I)
|
||||
I = usr.get_inactive_hand()
|
||||
I = src.get_inactive_hand()
|
||||
if(!I)
|
||||
usr << "<span class='warning'>You don't have anything in your hands to give to \the [target].</span>"
|
||||
src << "<span class='warning'>You don't have anything in your hands to give to \the [target].</span>"
|
||||
return
|
||||
|
||||
if(alert(target,"[usr] wants to give you \a [I]. Will you accept it?",,"No","Yes") == "No")
|
||||
target.visible_message("<span class='notice'>\The [usr] tried to hand \the [I] to \the [target], \
|
||||
if(alert(target,"[src] wants to give you \a [I]. Will you accept it?",,"No","Yes") == "No")
|
||||
target.visible_message("<span class='notice'>\The [src] tried to hand \the [I] to \the [target], \
|
||||
but \the [target] didn't want it.</span>")
|
||||
return
|
||||
|
||||
if(!I) return
|
||||
|
||||
if(!Adjacent(target))
|
||||
usr << "<span class='warning'>You need to stay in reaching distance while giving an object.</span>"
|
||||
target << "<span class='warning'>\The [usr] moved too far away.</span>"
|
||||
src << "<span class='warning'>You need to stay in reaching distance while giving an object.</span>"
|
||||
target << "<span class='warning'>\The [src] moved too far away.</span>"
|
||||
return
|
||||
|
||||
if(I.loc != usr || (usr.l_hand != I && usr.r_hand != I))
|
||||
usr << "<span class='warning'>You need to keep the item in your hands.</span>"
|
||||
target << "<span class='warning'>\The [usr] seems to have given up on passing \the [I] to you.</span>"
|
||||
if(I.loc != src || !src.item_is_in_hands(I))
|
||||
src << "<span class='warning'>You need to keep the item in your hands.</span>"
|
||||
target << "<span class='warning'>\The [src] seems to have given up on passing \the [I] to you.</span>"
|
||||
return
|
||||
|
||||
if(target.r_hand != null && target.l_hand != null)
|
||||
if(target.hands_are_full())
|
||||
target << "<span class='warning'>Your hands are full.</span>"
|
||||
usr << "<span class='warning'>Their hands are full.</span>"
|
||||
src << "<span class='warning'>Their hands are full.</span>"
|
||||
return
|
||||
|
||||
if(usr.unEquip(I))
|
||||
if(src.unEquip(I))
|
||||
target.put_in_hands(I) // If this fails it will just end up on the floor, but that's fitting for things like dionaea.
|
||||
target.visible_message("<span class='notice'>\The [usr] handed \the [I] to \the [target].</span>")
|
||||
target.visible_message("<span class='notice'>\The [src] handed \the [I] to \the [target].</span>")
|
||||
|
||||
@@ -538,9 +538,9 @@
|
||||
if ("handshake")
|
||||
m_type = 1
|
||||
if (!src.restrained() && !src.r_hand)
|
||||
var/mob/M = null
|
||||
var/mob/living/M = null
|
||||
if (param)
|
||||
for (var/mob/A in view(1, null))
|
||||
for (var/mob/living/A in view(1, null))
|
||||
if (param == A.name)
|
||||
M = A
|
||||
break
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
|
||||
var/covered = 0 // Basic coverage can help.
|
||||
for(var/obj/item/clothing/clothes in H)
|
||||
if(H.l_hand == clothes|| H.r_hand == clothes)
|
||||
if(H.item_is_in_hands(clothes))
|
||||
continue
|
||||
if((clothes.body_parts_covered & UPPER_TORSO) && (clothes.body_parts_covered & LOWER_TORSO))
|
||||
covered = 1
|
||||
|
||||
172
code/modules/mob/living/inventory.dm
Normal file
172
code/modules/mob/living/inventory.dm
Normal file
@@ -0,0 +1,172 @@
|
||||
/mob/living
|
||||
var/hand = null
|
||||
var/obj/item/l_hand = null
|
||||
var/obj/item/r_hand = null
|
||||
var/obj/item/weapon/back = null//Human/Monkey
|
||||
var/obj/item/weapon/tank/internal = null//Human/Monkey
|
||||
var/obj/item/clothing/mask/wear_mask = null//Carbon
|
||||
|
||||
/mob/living/equip_to_storage(obj/item/newitem)
|
||||
// Try put it in their backpack
|
||||
if(istype(src.back,/obj/item/weapon/storage))
|
||||
var/obj/item/weapon/storage/backpack = src.back
|
||||
if(backpack.contents.len < backpack.storage_slots)
|
||||
newitem.forceMove(src.back)
|
||||
return 1
|
||||
|
||||
// Try to place it in any item that can store stuff, on the mob.
|
||||
for(var/obj/item/weapon/storage/S in src.contents)
|
||||
if (S.contents.len < S.storage_slots)
|
||||
newitem.forceMove(S)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//Returns the thing in our active hand
|
||||
/mob/living/get_active_hand()
|
||||
if(hand) return l_hand
|
||||
else return r_hand
|
||||
|
||||
//Returns the thing in our inactive hand
|
||||
/mob/living/get_inactive_hand()
|
||||
if(hand) return r_hand
|
||||
else return l_hand
|
||||
|
||||
//Drops the item in our active hand. TODO: rename this to drop_active_hand or something
|
||||
/mob/living/drop_item(var/atom/Target)
|
||||
if(hand) return drop_l_hand(Target)
|
||||
else return drop_r_hand(Target)
|
||||
|
||||
//Drops the item in our left hand
|
||||
/mob/living/drop_l_hand(var/atom/Target)
|
||||
return drop_from_inventory(l_hand, Target)
|
||||
|
||||
//Drops the item in our right hand
|
||||
/mob/living/drop_r_hand(var/atom/Target)
|
||||
return drop_from_inventory(r_hand, Target)
|
||||
|
||||
/mob/living/proc/hands_are_full()
|
||||
return (r_hand && l_hand)
|
||||
|
||||
/mob/living/proc/item_is_in_hands(var/obj/item/I)
|
||||
return (I == r_hand || I == l_hand)
|
||||
|
||||
/mob/living/proc/update_held_icons()
|
||||
if(l_hand)
|
||||
l_hand.update_held_icon()
|
||||
if(r_hand)
|
||||
r_hand.update_held_icon()
|
||||
|
||||
/mob/living/proc/get_type_in_hands(var/T)
|
||||
if(istype(l_hand, T))
|
||||
return l_hand
|
||||
if(istype(r_hand, T))
|
||||
return r_hand
|
||||
return null
|
||||
|
||||
/mob/living/proc/get_left_hand()
|
||||
return l_hand
|
||||
|
||||
/mob/living/proc/get_right_hand()
|
||||
return r_hand
|
||||
|
||||
/mob/living/u_equip(obj/W as obj)
|
||||
if (W == r_hand)
|
||||
r_hand = null
|
||||
update_inv_r_hand(0)
|
||||
else if (W == l_hand)
|
||||
l_hand = null
|
||||
update_inv_l_hand(0)
|
||||
else if (W == back)
|
||||
back = null
|
||||
update_inv_back(0)
|
||||
else if (W == wear_mask)
|
||||
wear_mask = null
|
||||
update_inv_wear_mask(0)
|
||||
return
|
||||
|
||||
/mob/living/get_equipped_item(var/slot)
|
||||
switch(slot)
|
||||
if(slot_l_hand) return l_hand
|
||||
if(slot_r_hand) return r_hand
|
||||
if(slot_back) return back
|
||||
if(slot_wear_mask) return wear_mask
|
||||
return null
|
||||
|
||||
/mob/living/show_inv(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
var/dat = {"
|
||||
<B><HR><FONT size=3>[name]</FONT></B>
|
||||
<BR><HR>
|
||||
<BR><B>Head(Mask):</B> <A href='?src=\ref[src];item=mask'>[(wear_mask ? wear_mask : "Nothing")]</A>
|
||||
<BR><B>Left Hand:</B> <A href='?src=\ref[src];item=l_hand'>[(l_hand ? l_hand : "Nothing")]</A>
|
||||
<BR><B>Right Hand:</B> <A href='?src=\ref[src];item=r_hand'>[(r_hand ? r_hand : "Nothing")]</A>
|
||||
<BR><B>Back:</B> <A href='?src=\ref[src];item=back'>[(back ? back : "Nothing")]</A> [((istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/weapon/tank) && !( internal )) ? text(" <A href='?src=\ref[];item=internal'>Set Internal</A>", src) : "")]
|
||||
<BR>[(internal ? text("<A href='?src=\ref[src];item=internal'>Remove Internal</A>") : "")]
|
||||
<BR><A href='?src=\ref[src];item=pockets'>Empty Pockets</A>
|
||||
<BR><A href='?src=\ref[user];refresh=1'>Refresh</A>
|
||||
<BR><A href='?src=\ref[user];mach_close=mob[name]'>Close</A>
|
||||
<BR>"}
|
||||
user << browse(dat, text("window=mob[];size=325x500", name))
|
||||
onclose(user, "mob[name]")
|
||||
return
|
||||
|
||||
/mob/living/ret_grab(obj/effect/list_container/mobl/L as obj, flag)
|
||||
if ((!( istype(l_hand, /obj/item/weapon/grab) ) && !( istype(r_hand, /obj/item/weapon/grab) )))
|
||||
if (!( L ))
|
||||
return null
|
||||
else
|
||||
return L.container
|
||||
else
|
||||
if (!( L ))
|
||||
L = new /obj/effect/list_container/mobl( null )
|
||||
L.container += src
|
||||
L.master = src
|
||||
if (istype(l_hand, /obj/item/weapon/grab))
|
||||
var/obj/item/weapon/grab/G = l_hand
|
||||
if (!( L.container.Find(G.affecting) ))
|
||||
L.container += G.affecting
|
||||
if (G.affecting)
|
||||
G.affecting.ret_grab(L, 1)
|
||||
if (istype(r_hand, /obj/item/weapon/grab))
|
||||
var/obj/item/weapon/grab/G = r_hand
|
||||
if (!( L.container.Find(G.affecting) ))
|
||||
L.container += G.affecting
|
||||
if (G.affecting)
|
||||
G.affecting.ret_grab(L, 1)
|
||||
if (!( flag ))
|
||||
if (L.master == src)
|
||||
var/list/temp = list( )
|
||||
temp += L.container
|
||||
//L = null
|
||||
qdel(L)
|
||||
return temp
|
||||
else
|
||||
return L.container
|
||||
return
|
||||
|
||||
/mob/living/mode()
|
||||
set name = "Activate Held Object"
|
||||
set category = "Object"
|
||||
set src = usr
|
||||
|
||||
if(istype(loc,/obj/mecha)) return
|
||||
|
||||
if(hand)
|
||||
var/obj/item/W = l_hand
|
||||
if (W)
|
||||
W.attack_self(src)
|
||||
update_inv_l_hand()
|
||||
else
|
||||
var/obj/item/W = r_hand
|
||||
if (W)
|
||||
W.attack_self(src)
|
||||
update_inv_r_hand()
|
||||
return
|
||||
|
||||
/mob/living/abiotic(var/full_body = 0)
|
||||
if(full_body && ((src.l_hand && !( src.l_hand.abstract )) || (src.r_hand && !( src.r_hand.abstract )) || (src.back || src.wear_mask)))
|
||||
return 1
|
||||
|
||||
if((src.l_hand && !( src.l_hand.abstract )) || (src.r_hand && !( src.r_hand.abstract )))
|
||||
return 1
|
||||
return 0
|
||||
@@ -865,3 +865,63 @@ default behaviour is:
|
||||
sleep(350)
|
||||
lastpuke = 0
|
||||
|
||||
/mob/living/update_canmove()
|
||||
if(!resting && cannot_stand() && can_stand_overridden())
|
||||
lying = 0
|
||||
canmove = 1
|
||||
else
|
||||
if(istype(buckled, /obj/vehicle))
|
||||
var/obj/vehicle/V = buckled
|
||||
if(cannot_stand())
|
||||
lying = 0
|
||||
canmove = 1
|
||||
pixel_y = V.mob_offset_y - 5
|
||||
else
|
||||
if(buckled.buckle_lying != -1) lying = buckled.buckle_lying
|
||||
canmove = 1
|
||||
pixel_y = V.mob_offset_y
|
||||
else if(buckled)
|
||||
anchored = 1
|
||||
canmove = 0
|
||||
if(istype(buckled))
|
||||
if(buckled.buckle_lying != -1)
|
||||
lying = buckled.buckle_lying
|
||||
if(buckled.buckle_movable)
|
||||
anchored = 0
|
||||
canmove = 1
|
||||
|
||||
else if(cannot_stand())
|
||||
lying = 1
|
||||
canmove = 0
|
||||
else if(stunned)
|
||||
canmove = 0
|
||||
else if(captured)
|
||||
anchored = 1
|
||||
canmove = 0
|
||||
lying = 0
|
||||
else
|
||||
lying = 0
|
||||
canmove = 1
|
||||
|
||||
if(lying)
|
||||
density = 0
|
||||
if(l_hand) unEquip(l_hand)
|
||||
if(r_hand) unEquip(r_hand)
|
||||
else
|
||||
density = initial(density)
|
||||
|
||||
for(var/obj/item/weapon/grab/G in grabbed_by)
|
||||
if(G.state >= GRAB_AGGRESSIVE)
|
||||
canmove = 0
|
||||
break
|
||||
|
||||
//Temporarily moved here from the various life() procs
|
||||
//I'm fixing stuff incrementally so this will likely find a better home.
|
||||
//It just makes sense for now. ~Carn
|
||||
if( update_icon ) //forces a full overlay update
|
||||
update_icon = 0
|
||||
regenerate_icons()
|
||||
else if( lying != lying_prev )
|
||||
update_icons()
|
||||
return canmove
|
||||
|
||||
|
||||
@@ -195,21 +195,6 @@
|
||||
|
||||
|
||||
/mob/proc/show_inv(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
var/dat = {"
|
||||
<B><HR><FONT size=3>[name]</FONT></B>
|
||||
<BR><HR>
|
||||
<BR><B>Head(Mask):</B> <A href='?src=\ref[src];item=mask'>[(wear_mask ? wear_mask : "Nothing")]</A>
|
||||
<BR><B>Left Hand:</B> <A href='?src=\ref[src];item=l_hand'>[(l_hand ? l_hand : "Nothing")]</A>
|
||||
<BR><B>Right Hand:</B> <A href='?src=\ref[src];item=r_hand'>[(r_hand ? r_hand : "Nothing")]</A>
|
||||
<BR><B>Back:</B> <A href='?src=\ref[src];item=back'>[(back ? back : "Nothing")]</A> [((istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/weapon/tank) && !( internal )) ? text(" <A href='?src=\ref[];item=internal'>Set Internal</A>", src) : "")]
|
||||
<BR>[(internal ? text("<A href='?src=\ref[src];item=internal'>Remove Internal</A>") : "")]
|
||||
<BR><A href='?src=\ref[src];item=pockets'>Empty Pockets</A>
|
||||
<BR><A href='?src=\ref[user];refresh=1'>Refresh</A>
|
||||
<BR><A href='?src=\ref[user];mach_close=mob[name]'>Close</A>
|
||||
<BR>"}
|
||||
user << browse(dat, text("window=mob[];size=325x500", name))
|
||||
onclose(user, "mob[name]")
|
||||
return
|
||||
|
||||
//mob verbs are faster than object verbs. See http://www.byond.com/forum/?post=1326139&page=2#comment8198716 for why this isn't atom/verb/examine()
|
||||
@@ -248,37 +233,6 @@
|
||||
|
||||
|
||||
/mob/proc/ret_grab(obj/effect/list_container/mobl/L as obj, flag)
|
||||
if ((!( istype(l_hand, /obj/item/weapon/grab) ) && !( istype(r_hand, /obj/item/weapon/grab) )))
|
||||
if (!( L ))
|
||||
return null
|
||||
else
|
||||
return L.container
|
||||
else
|
||||
if (!( L ))
|
||||
L = new /obj/effect/list_container/mobl( null )
|
||||
L.container += src
|
||||
L.master = src
|
||||
if (istype(l_hand, /obj/item/weapon/grab))
|
||||
var/obj/item/weapon/grab/G = l_hand
|
||||
if (!( L.container.Find(G.affecting) ))
|
||||
L.container += G.affecting
|
||||
if (G.affecting)
|
||||
G.affecting.ret_grab(L, 1)
|
||||
if (istype(r_hand, /obj/item/weapon/grab))
|
||||
var/obj/item/weapon/grab/G = r_hand
|
||||
if (!( L.container.Find(G.affecting) ))
|
||||
L.container += G.affecting
|
||||
if (G.affecting)
|
||||
G.affecting.ret_grab(L, 1)
|
||||
if (!( flag ))
|
||||
if (L.master == src)
|
||||
var/list/temp = list( )
|
||||
temp += L.container
|
||||
//L = null
|
||||
qdel(L)
|
||||
return temp
|
||||
else
|
||||
return L.container
|
||||
return
|
||||
|
||||
/mob/verb/mode()
|
||||
@@ -286,18 +240,6 @@
|
||||
set category = "Object"
|
||||
set src = usr
|
||||
|
||||
if(istype(loc,/obj/mecha)) return
|
||||
|
||||
if(hand)
|
||||
var/obj/item/W = l_hand
|
||||
if (W)
|
||||
W.attack_self(src)
|
||||
update_inv_l_hand()
|
||||
else
|
||||
var/obj/item/W = r_hand
|
||||
if (W)
|
||||
W.attack_self(src)
|
||||
update_inv_r_hand()
|
||||
return
|
||||
|
||||
/*
|
||||
@@ -735,65 +677,6 @@
|
||||
|
||||
//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it.
|
||||
/mob/proc/update_canmove()
|
||||
|
||||
if(!resting && cannot_stand() && can_stand_overridden())
|
||||
lying = 0
|
||||
canmove = 1
|
||||
else
|
||||
if(istype(buckled, /obj/vehicle))
|
||||
var/obj/vehicle/V = buckled
|
||||
if(cannot_stand())
|
||||
lying = 0
|
||||
canmove = 1
|
||||
pixel_y = V.mob_offset_y - 5
|
||||
else
|
||||
if(buckled.buckle_lying != -1) lying = buckled.buckle_lying
|
||||
canmove = 1
|
||||
pixel_y = V.mob_offset_y
|
||||
else if(buckled)
|
||||
anchored = 1
|
||||
canmove = 0
|
||||
if(istype(buckled))
|
||||
if(buckled.buckle_lying != -1)
|
||||
lying = buckled.buckle_lying
|
||||
if(buckled.buckle_movable)
|
||||
anchored = 0
|
||||
canmove = 1
|
||||
|
||||
else if(cannot_stand())
|
||||
lying = 1
|
||||
canmove = 0
|
||||
else if(stunned)
|
||||
canmove = 0
|
||||
else if(captured)
|
||||
anchored = 1
|
||||
canmove = 0
|
||||
lying = 0
|
||||
else
|
||||
lying = 0
|
||||
canmove = 1
|
||||
|
||||
if(lying)
|
||||
density = 0
|
||||
if(l_hand) unEquip(l_hand)
|
||||
if(r_hand) unEquip(r_hand)
|
||||
else
|
||||
density = initial(density)
|
||||
|
||||
for(var/obj/item/weapon/grab/G in grabbed_by)
|
||||
if(G.state >= GRAB_AGGRESSIVE)
|
||||
canmove = 0
|
||||
break
|
||||
|
||||
//Temporarily moved here from the various life() procs
|
||||
//I'm fixing stuff incrementally so this will likely find a better home.
|
||||
//It just makes sense for now. ~Carn
|
||||
if( update_icon ) //forces a full overlay update
|
||||
update_icon = 0
|
||||
regenerate_icons()
|
||||
else if( lying != lying_prev )
|
||||
update_icons()
|
||||
|
||||
return canmove
|
||||
|
||||
|
||||
@@ -1007,8 +890,7 @@ mob/proc/yank_out_object()
|
||||
R.adjustFireLoss(10)
|
||||
|
||||
selection.forceMove(get_turf(src))
|
||||
if(!(U.l_hand && U.r_hand))
|
||||
U.put_in_hands(selection)
|
||||
U.put_in_hands(selection)
|
||||
|
||||
for(var/obj/item/weapon/O in pinned)
|
||||
if(O == selection)
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
var/next_move = null
|
||||
var/transforming = null //Carbon
|
||||
var/other = 0.0
|
||||
var/hand = null
|
||||
var/eye_blind = null //Carbon
|
||||
var/eye_blurry = null //Carbon
|
||||
var/ear_deaf = null //Carbon
|
||||
@@ -119,12 +118,6 @@
|
||||
var/m_intent = "run"//Living
|
||||
var/lastKnownIP = null
|
||||
var/obj/buckled = null//Living
|
||||
var/obj/item/l_hand = null//Living
|
||||
var/obj/item/r_hand = null//Living
|
||||
var/obj/item/weapon/back = null//Human/Monkey
|
||||
var/obj/item/weapon/tank/internal = null//Human/Monkey
|
||||
var/obj/item/weapon/storage/s_active = null//Carbon
|
||||
var/obj/item/clothing/mask/wear_mask = null//Carbon
|
||||
|
||||
var/seer = 0 //for cult//Carbon, probably Human
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
///Called by client/Move()
|
||||
///Checks to see if you are grabbing anything and if moving will affect your grab.
|
||||
/client/proc/Process_Grab()
|
||||
for(var/obj/item/weapon/grab/G in list(mob.l_hand, mob.r_hand))
|
||||
G.reset_kill_state() //no wandering across the station/asteroid while choking someone
|
||||
if(istype(mob, /mob/living))
|
||||
var/mob/living/L = mob
|
||||
for(var/obj/item/weapon/grab/G in list(L.l_hand, L.r_hand))
|
||||
G.reset_kill_state() //no wandering across the station/asteroid while choking someone
|
||||
|
||||
/obj/item/weapon/grab
|
||||
name = "grab"
|
||||
|
||||
@@ -288,12 +288,6 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
|
||||
|
||||
|
||||
/mob/proc/abiotic(var/full_body = 0)
|
||||
if(full_body && ((src.l_hand && !( src.l_hand.abstract )) || (src.r_hand && !( src.r_hand.abstract )) || (src.back || src.wear_mask)))
|
||||
return 1
|
||||
|
||||
if((src.l_hand && !( src.l_hand.abstract )) || (src.r_hand && !( src.r_hand.abstract )))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
//converts intent-strings into numbers and back
|
||||
|
||||
@@ -19,6 +19,15 @@
|
||||
/mob/proc/update_inv_back()
|
||||
return
|
||||
|
||||
/mob/proc/update_inv_active_hand()
|
||||
return
|
||||
|
||||
/mob/living/update_inv_active_hand(var/A)
|
||||
if(hand)
|
||||
update_inv_l_hand(A)
|
||||
else
|
||||
update_inv_r_hand(A)
|
||||
|
||||
/mob/proc/update_inv_l_hand()
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user