ugh...this was horrible. I'm really sorry if I fucked anything up, I was literally going braindead towards the end.

Replaced every l_hand = and r_hand = and all that if(hand) crap to use standardised procs. This means we can use procs like Dropped() reliably as they will always be called when things are dropped.

Thorough documentation to come. But generally, if you want a mob's icons to update after deleting something in the inventory...use drop_from_inventory(the_thing_you_wanna_drop) just before deleting it. If you wanna put something in a mob's hands use put_in_hands() (or one of the variants). It'll try putting it in active hand first, then inactive, then the floor. They handle layers, overlays, screenlocs calling various procs such as dropped() etc for you. Easy

mob.equipped() is now mob.get_active_hand() because there was another totally unrelated proc named equipped() and stuff was confusing.

Weakening was made instantaneous.

Minor optimisations for human/handle_regular_status_updates(). I'll port these changes over to the other mobs next. Basically it should stop it constantly incrementing every status effect even after death.

umm... bunch of overlays related fixes... I think that's everything. :/

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3900 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-06-23 21:24:45 +00:00
parent ce21bded5f
commit 48088b79d9
136 changed files with 972 additions and 1522 deletions
+1 -1
View File
@@ -43,7 +43,7 @@
attackby(W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/pen))
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
if (user.equipped() != W)
if (user.get_active_hand() != W)
return
if (!in_range(src, user) && src.loc != user)
return
+1 -1
View File
@@ -29,7 +29,7 @@
/obj/structure/extinguisher_cabinet/attack_hand(mob/user as mob)
if(has_extinguisher)
user.put_in_hand(has_extinguisher)
user.put_in_hands(has_extinguisher)
has_extinguisher = null
user << "\blue You take the extinguisher from the [name]."
opened = 1
+2 -2
View File
@@ -111,7 +111,7 @@
return
if(localopened)
if(fireaxe)
user.put_in_hand(fireaxe)
user.put_in_hands(fireaxe)
fireaxe = null
user << "\blue You take the fire axe from the [name]."
src.add_fingerprint(user)
@@ -160,7 +160,7 @@
if (localopened)
if(fireaxe)
usr.put_in_hand(fireaxe)
usr.put_in_hands(fireaxe)
fireaxe = null
usr << "\blue You take the Fire axe from the [name]."
else
+14 -20
View File
@@ -755,14 +755,12 @@ var/global/list/obj/item/device/pda/PDAs = list()
/obj/item/device/pda/proc/remove_id()
if (id)
if (istype(loc, /mob))
if (ismob(loc))
var/mob/M = loc
if(M.equipped() == null)
M.put_in_hand(id)
id = null
usr << "\blue You remove the ID from the [name]."
return
id.loc = get_turf(src)
M.put_in_hands(id)
usr << "<span class='notice'>You remove the ID from the [name].</span>"
else
id.loc = get_turf(src)
id = null
/obj/item/device/pda/proc/telecomms_process(var/receipent, var/originator, var/data)
@@ -820,8 +818,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(O)
if (istype(loc, /mob))
var/mob/M = loc
if(M.equipped() == null)
M.put_in_hand(O)
if(M.get_active_hand() == null)
M.put_in_hands(O)
usr << "<span class='notify'>You remove \the [O] from \the [src].</span>"
return
O.loc = get_turf(src)
@@ -835,23 +833,19 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (id)
remove_id()
else
var/obj/item/I = user.equipped()
var/obj/item/I = user.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
user.drop_item()
I.loc = src
id = I
else
var/obj/item/weapon/card/I = user.equipped()
var/obj/item/weapon/card/I = user.get_active_hand()
if (istype(I, /obj/item/weapon/card/id) && I:registered_name)
if(id)//Get id and replace it.
user.drop_item()
I.loc = src
user.put_in_hand(id)
id = I
else//Insert id.
user.drop_item()
I.loc = src
id = I
var/obj/old_id = id
user.drop_item()
I.loc = src
id = I
user.put_in_hands(old_id)
return
// access to status display signals
+3 -3
View File
@@ -36,7 +36,7 @@
var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( )
O.source = user
O.target = user
O.item = user.equipped()
O.item = user.get_active_hand()
O.s_loc = user.loc
O.t_loc = user.loc
O.place = "handcuff"
@@ -58,7 +58,7 @@
var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( )
O.source = user
O.target = M
O.item = user.equipped()
O.item = user.get_active_hand()
O.s_loc = user.loc
O.t_loc = M.loc
O.place = "handcuff"
@@ -77,7 +77,7 @@
var/obj/effect/equip_e/monkey/O = new /obj/effect/equip_e/monkey( )
O.source = user
O.target = M
O.item = user.equipped()
O.item = user.get_active_hand()
O.s_loc = user.loc
O.t_loc = M.loc
O.place = "handcuff"
+1 -1
View File
@@ -23,7 +23,7 @@
/obj/item/blueprints/Topic(href, href_list)
..()
if ((usr.restrained() || usr.stat || usr.equipped() != src))
if ((usr.restrained() || usr.stat || usr.get_active_hand() != src))
return
if (!href_list["action"])
return
+1 -8
View File
@@ -119,14 +119,7 @@
return
else
src.candlecount--
var/obj/item/candle/W = new /obj/item/candle(user)
if(user.hand)
user.l_hand = W
user.update_inv_l_hand()
else
user.r_hand = W
user.update_inv_r_hand()
W.layer = 20
user.put_in_hands(new /obj/item/candle(user))
else
return ..()
src.update_icon()
+23 -82
View File
@@ -37,16 +37,8 @@ MONKEY CUBE BOX
/obj/item/kitchen/donut_box/MouseDrop(mob/user as mob)
if ((user == usr && (!( usr.restrained() ) && (!( usr.stat ) && (usr.contents.Find(src) || in_range(src, usr))))))
if(!istype(user, /mob/living/carbon/metroid))
if (usr.hand)
if (!( usr.l_hand ))
spawn( 0 )
src.attack_hand(usr, 1, 1)
return
else
if (!( usr.r_hand ))
spawn( 0 )
src.attack_hand(usr, 0, 1)
return
if( !usr.get_active_hand() )
src.attack_hand(usr, usr.hand, 1)
return
/obj/item/kitchen/donut_box/attack_paw(mob/user as mob)
@@ -56,36 +48,15 @@ MONKEY CUBE BOX
if (flag)
return ..()
src.add_fingerprint(user)
if (locate(/obj/item/weapon/reagent_containers/food/snacks/donut, src))
for(var/obj/item/weapon/reagent_containers/food/snacks/donut/P in src)
if (!usr.l_hand)
P.loc = usr
P.layer = 20
usr.l_hand = P
usr.update_inv_l_hand()
usr << "You take a donut out of the box."
break
else if (!usr.r_hand)
P.loc = usr
P.layer = 20
usr.r_hand = P
usr.update_inv_r_hand()
usr << "You take a donut out of the box."
break
else
if (src.amount >= 1)
src.amount--
var/obj/item/weapon/reagent_containers/food/snacks/donut/D = new /obj/item/weapon/reagent_containers/food/snacks/donut
D.loc = usr.loc
if(ishuman(usr))
if(!usr.get_active_hand())
usr.put_in_hand(D)
usr << "You take a donut out of the box."
else
D.loc = get_turf_loc(src)
usr << "You take a donut out of the box."
src.update()
var/obj/item/weapon/reagent_containers/food/snacks/donut/P = locate() in src
if(!P && (amount >= 1))
P = new /obj/item/weapon/reagent_containers/food/snacks/donut( src )
if(P)
usr.put_in_hands(P)
usr << "You take a donut out of the box."
src.amount--
src.update()
return
/obj/item/kitchen/donut_box/examine()
@@ -112,16 +83,9 @@ MONKEY CUBE BOX
/obj/item/kitchen/egg_box/MouseDrop(mob/user as mob)
if ((user == usr && (!( usr.restrained() ) && (!( usr.stat ) && (usr.contents.Find(src) || in_range(src, usr))))))
if (usr.hand)
if (!( usr.l_hand ))
spawn( 0 )
src.attack_hand(usr, 1, 1)
return
else
if (!( usr.r_hand ))
spawn( 0 )
src.attack_hand(usr, 0, 1)
return
if( !usr.get_active_hand() )
attack_hand(usr, usr.hand, 1)
return
return
/obj/item/kitchen/egg_box/attack_paw(mob/user as mob)
@@ -131,32 +95,17 @@ MONKEY CUBE BOX
if (flag)
return ..()
src.add_fingerprint(user)
if (locate(/obj/item/weapon/reagent_containers/food/snacks/egg, src))
for(var/obj/item/weapon/reagent_containers/food/snacks/egg/P in src)
if (!usr.l_hand)
P.loc = usr.loc
P.layer = 20
usr.l_hand = P
P = null
usr.update_inv_l_hand()
usr << "You take an egg out of the box."
break
else if (!usr.r_hand)
P.loc = usr.loc
P.layer = 20
usr.r_hand = P
P = null
usr.update_inv_r_hand()
usr << "You take an egg out of the box."
break
else
if (src.amount >= 1)
src.amount--
new /obj/item/weapon/reagent_containers/food/snacks/egg( src.loc )
usr << "You take an egg out of the box."
src.update()
var/obj/item/weapon/reagent_containers/food/snacks/egg/P = locate() in src
if(!P && (amount >= 1))
P = new /obj/item/weapon/reagent_containers/food/snacks/egg( src )
if(P)
usr.put_in_hands(P)
usr << "You take an egg out of the box."
src.amount--
src.update()
return
/obj/item/kitchen/egg_box/examine()
set src in oview(1)
@@ -186,15 +135,7 @@ MONKEY CUBE BOX
if(user.r_hand == src || user.l_hand == src)
if(amount)
var/obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped/M = new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(src)
if (user.hand)
user.l_hand = M
user.update_inv_l_hand()
else
user.r_hand = M
user.update_inv_r_hand()
M.loc = user
M.layer = 20
user.put_in_hands(new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(user))
user << "You take a monkey cube out of the box."
amount--
else
+4 -17
View File
@@ -23,7 +23,7 @@
/obj/item/proc/equipped(var/mob/user, var/slot)
return
//
// ***TODO: implement unequipped()
// ***TODO: implement unget_active_hand()
//
/obj/item/proc/afterattack()
@@ -119,15 +119,8 @@
src.pickup(user)
user.lastDblClick = world.time + 2
user.next_move = world.time + 2
src.loc = user
src.layer = 20
add_fingerprint(user)
if (user.hand)
user.l_hand = src
user.update_inv_l_hand()
else
user.r_hand = src
user.update_inv_r_hand()
user.put_in_active_hand(src)
return
@@ -158,14 +151,8 @@
src.pickup(user)
user.lastDblClick = world.time + 2
user.next_move = world.time + 2
src.loc = user
src.layer = 20
if (user.hand)
user.l_hand = src
user.update_inv_l_hand()
else
user.r_hand = src
user.update_inv_r_hand()
user.put_in_active_hand(src)
return
/obj/item/attackby(obj/item/weapon/W as obj, mob/user as mob)
+4 -8
View File
@@ -20,7 +20,9 @@
return
//stops TK grabs being equipped anywhere but into hands
equipped(var/mob/user, var/slot)
if( (slot=="l_hand") || (slot=="r_hand") ) return
del(src)
return
@@ -29,13 +31,7 @@
if(!istype(focus,/obj/item)) return
if(!check_path()) return//No clear path
if(user.hand == src)
user.l_hand = focus
else
user.r_hand = focus
focus.loc = user
focus.layer = 20
user.put_in_hands(focus)
add_fingerprint(user)
user.update_inv_l_hand(0)
user.update_inv_r_hand()
@@ -117,7 +113,7 @@
/*
if(istype(user, /mob/living/carbon))
if(user:mutations & TK && get_dist(source, user) <= 7)
if(user:equipped()) return 0
if(user:get_active_hand()) return 0
var/X = source:x
var/Y = source:y
var/Z = source:z
+6 -10
View File
@@ -13,17 +13,13 @@
return ..()
playsound(src.loc, "rustle", 50, 1, -5)
if ((!( M.restrained() ) && !( M.stat ) && M.back == src))
if (over_object.name == "r_hand")
if (!( M.r_hand ))
switch(over_object.name)
if("r_hand")
M.u_equip(src)
M.r_hand = src
M.update_inv_r_hand()
else
if (over_object.name == "l_hand")
if (!( M.l_hand ))
M.u_equip(src)
M.l_hand = src
M.update_inv_l_hand()
M.put_in_r_hand(src)
if("l_hand")
M.u_equip(src)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
+4 -18
View File
@@ -92,17 +92,7 @@ FINGERPRINT CARD
if (href_list["remove"])
var/obj/item/P = locate(href_list["remove"])
if ((P && P.loc == src))
if ((usr.hand && !( usr.l_hand )))
usr.l_hand = P
P.loc = usr
P.layer = 20
usr.update_inv_l_hand()
else
if (!( usr.r_hand ))
usr.r_hand = P
P.loc = usr
P.layer = 20
usr.update_inv_r_hand()
usr.put_in_hands(P)
src.add_fingerprint(usr)
P.add_fingerprint(usr)
src.update()
@@ -150,7 +140,7 @@ FINGERPRINT CARD
else
if (istype(P, /obj/item/weapon/pen))
var/t = input(user, "Holder Label:", text("[]", src.name), null) as text
if (user.equipped() != P)
if (user.get_active_hand() != P)
return
if ((!in_range(src, usr) && src.loc != user))
return
@@ -209,11 +199,7 @@ FINGERPRINT CARD
var/obj/item/weapon/f_card/F = new /obj/item/weapon/f_card( user )
F.amount = 1
src.amount--
if (user.hand)
user.l_hand = F
else
user.r_hand = F
F.layer = 20
user.put_in_hands(F)
F.add_fingerprint(user)
if (src.amount < 1)
//SN src = null
@@ -244,7 +230,7 @@ FINGERPRINT CARD
else
if (istype(W, /obj/item/weapon/pen))
var/t = input(user, "Card Label:", text("[]", src.name), null) as text
if (user.equipped() != W)
if (user.get_active_hand() != W)
return
if ((!in_range(src, usr) && src.loc != user))
return
@@ -71,14 +71,7 @@ ZIPPO
return
else
src.matchcount--
var/obj/item/weapon/match/W = new /obj/item/weapon/match(user)
if(user.hand)
user.l_hand = W
user.update_inv_l_hand()
else
user.r_hand = W
user.update_inv_r_hand()
W.layer = 20
user.put_in_active_hand(new /obj/item/weapon/match(user))
else
return ..()
if(src.matchcount <= 0)
@@ -430,13 +423,7 @@ ZIPPO
cigcount--
var/obj/item/clothing/mask/cigarette/W = new /obj/item/clothing/mask/cigarette(user)
reagents.trans_to(W, reagents.total_volume)
if(user.hand)
user.l_hand = W
user.update_inv_l_hand()
else
user.r_hand = W
user.update_inv_r_hand()
W.layer = 20
user.put_in_active_hand(W)
else
return ..()
update_icon()
+4 -4
View File
@@ -30,7 +30,7 @@ CRITTER GRENADE
afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
if (istype(target, /obj/item/weapon/storage)) return ..() // Trying to put it in a full container
if (istype(target, /obj/item/weapon/gun/grenadelauncher)) return ..()
if((user.equipped() == src)&&(!active)&&(clown_check(user)))
if((user.get_active_hand() == src)&&(!active)&&(clown_check(user)))
user << "\red You prime the emp grenade! [det_time/10] seconds!"
src.active = 1
src.icon_state = "empar"
@@ -130,7 +130,7 @@ CRITTER GRENADE
afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
if (istype(target, /obj/item/weapon/storage)) return ..() // Trying to put it in a full container
if (istype(target, /obj/item/weapon/gun/grenadelauncher)) return ..()
if((user.equipped() == src)&&(!active)&&(clown_check(user)))
if((user.get_active_hand() == src)&&(!active)&&(clown_check(user)))
user << "\red You prime the flashbang! [det_time/10] seconds!"
src.active = 1
src.icon_state = "flashbang1"
@@ -302,7 +302,7 @@ CRITTER GRENADE
afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
if (istype(target, /obj/item/weapon/storage)) return ..() // Trying to put it in a full container
if (istype(target, /obj/item/weapon/gun/grenadelauncher)) return ..()
if((user.equipped() == src)&&(!active))
if((user.get_active_hand() == src)&&(!active))
//world << "cluster after attack"
arm(user)
user.dir = get_dir(user, target)
@@ -409,7 +409,7 @@ CRITTER GRENADE
afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
if (istype(target, /obj/item/weapon/storage)) return ..() // Trying to put it in a full container
if (istype(target, /obj/item/weapon/gun/grenadelauncher)) return ..()
if((user.equipped() == src)&&(!active)&&(clown_check(user)))
if((user.get_active_hand() == src)&&(!active)&&(clown_check(user)))
user << "\red You prime the delivery grenade! [det_time/10] seconds!"
src.active = 1
src.icon_state = "delivery1"
@@ -25,7 +25,7 @@
..()
if (istype(I, /obj/item/weapon/pen))
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
if (user.equipped() != I)
if (user.get_active_hand() != I)
return
if((!in_range(src, usr) && src.loc != user))
return
@@ -71,7 +71,7 @@
var/obj/item/weapon/melee/energy/blade/swordspawn = new /obj/item/weapon/melee/energy/blade
if(!source.get_active_hand())
source.put_in_hand(swordspawn)
source.put_in_hands(swordspawn)
var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread()
spark_system.set_up(5, 0, source.loc)
@@ -26,18 +26,11 @@
attack_hand(mob/user as mob)
if ((src.case && (user.l_hand == src || user.r_hand == src)))
if (user.hand)
user.l_hand = src.case
user.update_inv_l_hand()
else
user.r_hand = src.case
user.update_inv_r_hand()
src.case.loc = user
src.case.layer = 20
user.put_in_active_hand(case)
src.case.add_fingerprint(user)
src.case = null
user.update_inv_l_hand(0)
user.update_inv_r_hand()
src.add_fingerprint(user)
update()
else
+1 -1
View File
@@ -53,7 +53,7 @@ var/global/list/cached_icons = list()
attack_self(mob/user as mob)
var/t1 = input(user, "Please select a color:", "Locking Computer", null) in list( "red", "blue", "green", "yellow", "black", "white")
if ((user.equipped() != src || user.stat || user.restrained()))
if ((user.get_active_hand() != src || user.stat || user.restrained()))
return
switch(t1)
if("red")
@@ -26,8 +26,8 @@ RACK PARTS
user << "\red You need at least four rods to do this."
/obj/item/weapon/table_parts/attack_self(mob/user as mob)
var/obj/structure/table/T = new /obj/structure/table( user.loc )
T.add_fingerprint(usr)
new /obj/structure/table( user.loc )
user.drop_item()
del(src)
return
@@ -35,11 +35,11 @@ RACK PARTS
/obj/item/weapon/table_parts/wood/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/wrench))
new /obj/item/stack/sheet/wood( src.loc )
//SN src = null
del(src)
/obj/item/weapon/table_parts/wood/attack_self(mob/user as mob)
new /obj/structure/table/woodentable( user.loc )
user.drop_item()
del(src)
return
@@ -49,11 +49,11 @@ RACK PARTS
if (istype(W, /obj/item/weapon/wrench))
new /obj/item/stack/sheet/metal( src.loc )
new /obj/item/stack/rods( src.loc )
//SN src = null
del(src)
/obj/item/weapon/table_parts/reinforced/attack_self(mob/user as mob)
new /obj/structure/table/reinforced( user.loc )
user.drop_item()
del(src)
return
@@ -73,5 +73,6 @@ RACK PARTS
/obj/item/weapon/rack_parts/attack_self(mob/user as mob)
var/obj/structure/rack/R = new /obj/structure/rack( user.loc )
R.add_fingerprint(user)
user.drop_item()
del(src)
return
@@ -122,7 +122,7 @@ Frequency:
if(turfs.len)
L["None (Dangerous)"] = pick(turfs)
var/t1 = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") in L
if ((user.equipped() != src || user.stat || user.restrained()))
if ((user.get_active_hand() != src || user.stat || user.restrained()))
return
var/count = 0 //num of portals from this teleport in world
for(var/obj/effect/portal/PO in world)
+3 -12
View File
@@ -25,14 +25,9 @@
/obj/item/weapon/twohanded/dropped(mob/user as mob)
//handles unwielding a twohanded weapon when dropped as well as clearing up the offhand
//bit of a hack but it keeps other code pretty neat and with fewer conditionals
var/obj/item/weapon/twohanded/O
if(user)
if(user.l_hand)
O = user.l_hand
else
O = user.r_hand
if(O && istype(O))
var/obj/item/weapon/twohanded/O = user.get_inactive_hand()
if(istype(O))
O.unwield()
return unwield()
@@ -67,11 +62,7 @@
var/obj/item/weapon/twohanded/offhand/O = new(user) ////Let's reserve his other hand~
O.name = "[initial(name)] - offhand"
O.desc = "Your second grip on the [initial(name)]"
if(user.hand)
user.r_hand = O ///Place dat offhand in the opposite hand
else
user.l_hand = O
O.layer = 20
user.put_in_inactive_hand(O)
return
///////////OFFHAND///////////////
@@ -32,7 +32,6 @@ PHOTOGRAPHS
src.add_fingerprint(user)
if (src.amount <= 0)
new /obj/item/weapon/c_tube( src.loc )
//SN src = null
del(src)
return
else
@@ -67,7 +66,7 @@ PHOTOGRAPHS
log_attack("<font color='red'>[user.name] ([user.ckey]) used the [src.name] to wrap [target.name] ([target.ckey])</font>")
else
user << "/blue You need more paper."
user << "\blue You need more paper."
else
user << "Theyre moving around too much. a Straitjacket would help."
@@ -78,18 +77,12 @@ PHOTOGRAPHS
// GIFTS
/obj/item/weapon/gift/attack_self(mob/user as mob)
if(!src.gift)
user << "\blue The gift was empty!"
del(src)
src.gift.loc = user
if (user.hand)
user.l_hand = src.gift
user.update_inv_l_hand()
user.drop_item()
if(src.gift)
user.put_in_active_hand(gift)
src.gift.add_fingerprint(user)
else
user.r_hand = src.gift
user.update_inv_r_hand()
src.gift.layer = 20
src.gift.add_fingerprint(user)
user << "\blue The gift was empty!"
del(src)
return
@@ -107,7 +100,7 @@ PHOTOGRAPHS
..()
if (!istype(W, /obj/item/weapon/wirecutters))
user << "/blue I need wirecutters for that."
user << "\blue I need wirecutters for that."
return
user << "\blue You cut open the present."
@@ -125,67 +118,32 @@ PHOTOGRAPHS
switch(pick("flash", "t_gun", "l_gun", "shield", "sword", "axe"))
if("flash")
var/obj/item/device/flash/W = new /obj/item/device/flash( M )
if (M.hand)
M.l_hand = W
M.update_inv_l_hand()
else
M.r_hand = W
M.update_inv_r_hand()
W.layer = 20
M.put_in_active_hand(W)
W.add_fingerprint(M)
//SN src = null
del(src)
return
if("l_gun")
var/obj/item/weapon/gun/energy/laser/W = new /obj/item/weapon/gun/energy/laser( M )
if (M.hand)
M.l_hand = W
M.update_inv_l_hand()
else
M.r_hand = W
M.update_inv_r_hand()
W.layer = 20
M.put_in_active_hand(W)
W.add_fingerprint(M)
//SN src = null
del(src)
return
if("t_gun")
var/obj/item/weapon/gun/energy/taser/W = new /obj/item/weapon/gun/energy/taser( M )
if (M.hand)
M.l_hand = W
M.update_inv_l_hand()
else
M.r_hand = W
M.update_inv_r_hand()
W.layer = 20
M.put_in_active_hand(W)
W.add_fingerprint(M)
//SN src = null
del(src)
return
if("sword")
var/obj/item/weapon/melee/energy/sword/W = new /obj/item/weapon/melee/energy/sword( M )
if (M.hand)
M.l_hand = W
M.update_inv_l_hand()
else
M.r_hand = W
M.update_inv_r_hand()
W.layer = 20
M.put_in_active_hand(W)
W.add_fingerprint(M)
//SN src = null
del(src)
return
if("axe")
var/obj/item/weapon/melee/energy/axe/W = new /obj/item/weapon/melee/energy/axe( M )
if (M.hand)
M.l_hand = W
M.update_inv_l_hand()
else
M.r_hand = W
M.update_inv_r_hand()
W.layer = 20
M.put_in_active_hand(W)
W.add_fingerprint(M)
//SN src = null
del(src)
return
else
@@ -195,7 +153,6 @@ PHOTOGRAPHS
/obj/structure/bedsheetbin/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/bedsheet))
//W = null
del(W)
src.amount++
return
+1 -1
View File
@@ -59,7 +59,7 @@
slot_flags = SLOT_BELT
/obj/item/weapon/firbang/afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
if (user.equipped() == src)
if (user.get_active_hand() == src)
if ((CLUMSY in usr.mutations) && prob(50))
user << "\red Huh? How does this thing work?!"
src.state = 1
+9 -14
View File
@@ -50,28 +50,23 @@
if (istype(W, /obj/item/clothing/head/helmet))
var/obj/item/assembly/shock_kit/A = new /obj/item/assembly/shock_kit( user )
A.icon = 'assemblies.dmi'
user.u_equip(W)
W.loc = A
A.part1 = W
W.layer = initial(W.layer)
if (user.client)
user.client.screen -= W
if (user.r_hand == W)
user.u_equip(W)
user.r_hand = A
user.update_inv_r_hand()
if(user.r_hand == W)
user.put_in_r_hand(A)
else
user.u_equip(W)
user.l_hand = A
user.update_inv_l_hand()
user.put_in_l_hand(A)
W.master = A
src.master = A
src.layer = initial(src.layer)
user.u_equip(src)
if (user.client)
user.client.screen -= src
src.loc = A
A.part2 = src
A.layer = 20
src.add_fingerprint(user)
A.add_fingerprint(user)
return
+7 -14
View File
@@ -189,21 +189,14 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
// now transform the regular radio, into a (disguised)syndicate uplink!
var/obj/item/device/uplink/radio/T = traitorradio
var/obj/item/device/radio/R = src
usr.u_equip(R)
R.loc = T
T.loc = usr
R.layer = 0
if (usr.client)
usr.client.screen -= R
if (usr.r_hand == R)
usr.u_equip(R)
usr.r_hand = T
usr.update_inv_r_hand()
if(usr.r_hand == R)
usr.put_in_r_hand(T)
else
usr.u_equip(R)
usr.l_hand = T
usr.update_inv_l_hand()
R.loc = T
T.layer = 20
usr.put_in_l_hand(T)
T.attack_self(usr)
return
else if (href_list["talk"])
@@ -219,7 +212,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
channels[chan_name] |= FREQ_LISTENING
else if (href_list["wires"])
var/t1 = text2num(href_list["wires"])
if (!( istype(usr.equipped(), /obj/item/weapon/wirecutters) ))
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
return
if (wires & t1)
wires &= ~t1
+2 -2
View File
@@ -49,7 +49,7 @@
pinned_target.loc = user.loc
if(ishuman(user))
if(!user.get_active_hand())
user.put_in_hand(pinned_target)
user.put_in_hands(pinned_target)
user << "You take the target out of the stake."
else
pinned_target.loc = get_turf_loc(user)
@@ -119,7 +119,7 @@
loc = user.loc
if(ishuman(user))
if(!user.get_active_hand())
user.put_in_hand(src)
user.put_in_hands(src)
user << "You take the target out of the stake."
else
src.loc = get_turf_loc(user)
+1 -1
View File
@@ -38,7 +38,7 @@ SHARDS
var/replace = (user.get_inactive_hand()==G)
G.use(1)
if (!G && !RG && replace)
user.put_in_hand(RG)
user.put_in_hands(RG)
else
return ..()
+1 -1
View File
@@ -29,7 +29,7 @@ FLOOR TILES
var/replace = (user.get_inactive_hand()==R)
R.use(2)
if (!R && replace)
user.put_in_hand(new_item)
user.put_in_hands(new_item)
return
..()
+3 -3
View File
@@ -52,7 +52,7 @@
if (user.get_inactive_hand() == src)
var/obj/item/stack/F = new src.type( user, amount=1)
F.copy_evidences(src)
user.put_in_hand(F)
user.put_in_hands(F)
src.add_fingerprint(user)
F.add_fingerprint(user)
use(1)
@@ -165,7 +165,7 @@
/obj/item/stack/Topic(href, href_list)
..()
if ((usr.restrained() || usr.stat || usr.equipped() != src))
if ((usr.restrained() || usr.stat || usr.get_active_hand() != src))
return
if (href_list["make"])
if (src.amount < 1) del(src) //Never should happen
@@ -204,7 +204,7 @@
usr.before_take_item(oldsrc)
del(oldsrc)
if (istype(O,/obj/item))
usr.put_in_hand(O)
usr.put_in_hands(O)
O.add_fingerprint(usr)
//BubbleWrap - so newly formed boxes are empty
if ( istype(O, /obj/item/weapon/storage) )
+11 -11
View File
@@ -49,8 +49,8 @@
if(buckled_mob)
if(buckled_mob.buckled == src) //this is probably unneccesary, but it doesn't hurt
buckled_mob.buckled = null
buckled_mob.anchored = 0
buckled_mob.lying = 0
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.update_canmove()
buckled_mob = null
return
@@ -74,7 +74,7 @@
/obj/structure/stool/bed/proc/buckle_mob(mob/M as mob, mob/user as mob)
if (!ticker)
user << "You can't buckle anyone in before the game starts."
if ((!( istype(M, /mob) ) || get_dist(src, user) > 1 || M.loc != src.loc || user.restrained() || usr.stat || M.buckled || istype(user, /mob/living/silicon/pai)))
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || usr.stat || M.buckled || istype(user, /mob/living/silicon/pai) )
return
unbuckle()
@@ -89,10 +89,10 @@
"\blue [M.name] is buckled in to [src] by [user.name]!",\
"You are buckled in to [src] by [user.name].",\
"You hear metal clanking")
M.anchored = 1
M.buckled = src
M.loc = src.loc
M.dir = src.dir
M.update_canmove()
src.buckled_mob = M
src.add_fingerprint(user)
return
@@ -100,8 +100,6 @@
/obj/structure/stool/bed/MouseDrop_T(mob/M as mob, mob/user as mob)
if(!istype(M)) return
buckle_mob(M, user)
// M.lying = 1
// M.update_icons() //update our icons to reflect our lying/standing status
return
/obj/structure/stool/bed/attack_paw(mob/user as mob)
@@ -137,7 +135,6 @@
/obj/structure/stool/bed/chair/MouseDrop_T(mob/M as mob, mob/user as mob)
if(!istype(M)) return
buckle_mob(M, user)
// M.update_icons() //update our icons to reflect our lying/standing status
return
//roller bed
@@ -155,7 +152,7 @@
buckled_mob.loc = src.loc
/obj/structure/stool/bed/roller/buckle_mob(mob/M as mob, mob/user as mob)
if ((!( istype(M, /mob) ) || get_dist(src, user) > 1 || M.loc != src.loc || user.restrained() || usr.stat || M.buckled || istype(usr, /mob/living/silicon/pai)))
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || usr.stat || M.buckled || istype(usr, /mob/living/silicon/pai) )
return
M.pixel_y = 6
density = 1
@@ -165,9 +162,12 @@
/obj/structure/stool/bed/roller/manual_unbuckle(mob/user as mob)
if(buckled_mob)
buckled_mob.pixel_y = 0
buckled_mob.anchored = 0
buckled_mob.buckled = null
if(buckled_mob.buckled == src) //this is probably unneccesary, but it doesn't hurt
buckled_mob.pixel_y = 0
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.buckled = null
buckled_mob.update_canmove()
buckled_mob = null
density = 0
icon_state = "down"
..()
+6 -10
View File
@@ -5,17 +5,13 @@
return ..()
playsound(src.loc, "rustle", 50, 1, -5)
if ((!( M.restrained() ) && !( M.stat ) && M.back == src))
if (over_object.name == "r_hand")
if (!( M.r_hand ))
switch(over_object.name)
if("r_hand")
M.u_equip(src)
M.r_hand = src
M.update_inv_r_hand()
else
if (over_object.name == "l_hand")
if (!( M.l_hand ))
M.u_equip(src)
M.l_hand = src
M.update_inv_l_hand()
M.put_in_r_hand(src)
if("l_hand")
M.u_equip(src)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
+6 -10
View File
@@ -23,17 +23,13 @@
return ..()
playsound(src.loc, "rustle", 50, 1, -5)
if (!M.restrained() && !M.stat && can_use())
if (over_object.name == "r_hand")
if (!( M.r_hand ))
switch(over_object.name)
if("r_hand")
M.u_equip(src)
M.r_hand = src
M.update_inv_r_hand()
else
if (over_object.name == "l_hand")
if (!( M.l_hand ))
M.u_equip(src)
M.l_hand = src
M.update_inv_l_hand()
M.put_in_r_hand(src)
if("l_hand")
M.u_equip(src)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
+6 -10
View File
@@ -94,17 +94,13 @@
if (!( istype(over_object, /obj/screen) ))
return ..()
if ((!( M.restrained() ) && !( M.stat )))
if (over_object.name == "r_hand")
if (!( M.r_hand ))
switch(over_object.name)
if("r_hand")
M.u_equip(src)
M.r_hand = src
M.update_inv_r_hand()
else
if (over_object.name == "l_hand")
if (!( M.l_hand ))
M.u_equip(src)
M.l_hand = src
M.update_inv_l_hand()
M.put_in_r_hand(src)
if("l_hand")
M.u_equip(src)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
+9 -14
View File
@@ -33,9 +33,8 @@
user.show_message(text("\red <B>You reach into the [src.name], but there was a live mousetrap in there!</B>"), 1)
else
user.show_message(text("\red <B>[user] reaches into the [src.name] and sets off a hidden mousetrap!</B>"), 1)
MT.loc = user.loc
user.drop_from_inventory(MT)
MT.triggered(user, user.hand ? "l_hand" : "r_hand")
MT.layer = OBJ_LAYER
return
user.client.screen -= src.boxes
user.client.screen -= src.closer
@@ -207,11 +206,11 @@
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.l_store == src && !H.get_active_hand())
H.put_in_hand(src)
H.put_in_hands(src)
H.l_store = null
return
if(H.r_store == src && !H.get_active_hand())
H.put_in_hand(src)
H.put_in_hands(src)
H.r_store = null
return
@@ -370,17 +369,13 @@
if (!( istype(over_object, /obj/screen) ))
return ..()
if ((!( M.restrained() ) && !( M.stat ) /*&& M.pocket == src*/))
if (over_object.name == "r_hand")
if (!( M.r_hand ))
switch(over_object.name)
if("r_hand")
M.u_equip(src)
M.r_hand = src
M.update_inv_r_hand()
else
if (over_object.name == "l_hand")
if (!( M.l_hand ))
M.u_equip(src)
M.l_hand = src
M.update_inv_l_hand()
M.put_in_r_hand(src)
if("l_hand")
M.u_equip(src)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
+2 -2
View File
@@ -125,7 +125,7 @@ TABLE AND RACK OBJECT INTERATIONS
/obj/structure/table/MouseDrop_T(obj/O as obj, mob/user as mob)
if ((!( istype(O, /obj/item/weapon) ) || user.equipped() != O))
if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O))
return
if(isrobot(user))
return
@@ -323,7 +323,7 @@ TABLE AND RACK OBJECT INTERATIONS
return 0
/obj/structure/rack/MouseDrop_T(obj/O as obj, mob/user as mob)
if ((!( istype(O, /obj/item/weapon) ) || user.equipped() != O))
if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O))
return
if(isrobot(user))
return
+6 -10
View File
@@ -41,17 +41,13 @@ CRAYONS
if (!( istype(over_object, /obj/screen) ))
return ..()
if ((!( M.restrained() ) && !( M.stat )))
if (over_object.name == "r_hand")
if (!( M.r_hand ))
switch(over_object.name)
if("r_hand")
M.u_equip(src)
M.r_hand = src
M.update_inv_r_hand()
else
if (over_object.name == "l_hand")
if (!( M.l_hand ))
M.u_equip(src)
M.l_hand = src
M.update_inv_l_hand()
M.put_in_r_hand(src)
if("l_hand")
M.u_equip(src)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
+1 -1
View File
@@ -528,7 +528,7 @@ A list of items and costs is stored under the datum of every game mode, alongsid
var/mob/L = src.loc
R.loc = T
T.loc = L
// R.layer = initial(R.layer)
// R.layer = initial(R.layer) //TODO: CARN
R.layer = 0
if (istype(L))
if (L.client)
+1 -1
View File
@@ -31,7 +31,7 @@
if(ishuman(user))
if(!user.get_active_hand())
I.loc = user.loc
user.put_in_hand(I)
user.put_in_hands(I)
else
I.loc = get_turf(src)
user << "<span class='notice'>You find \an [I] in the cistern.</span>"