mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-05 23:21:53 +00:00
update_clothing() has been broken up into it's key parts. A full explanation can be found in code/modules/mob/living/carbon/human/update_icons.dm the tl;dr of it is that overlay updates are no longer called by the gameticker. Instead they are called by procs such as u_equip db_cick etc. This means faster updates (although admittedly, more of them can be called per tick). This however is offset by the fact that specific overlays can be updated now, vastly improving its efficiency. This will especially help when there are large numbers of dead mobs. Fixed the throw code for TKgrab so it can be toggled. Cloaking for aliens/humans/ninjas was changed. It's very crude at the moment and for that I apologise. But it works and is very efficient.It also stops cloaked individuals becomming invincible due to people being unable to hit them (even when they know exactly where they are) Fixed a bunch of bugs with damage-overlays. They were updating FAR FAR to frequently. They were also horribly inefficient. They should now be virtually seamless when updating and only use cached icons, so they aren't affected by lag as badly. This may help with explosions lag a little. There's still a tonne of stuff I need to refine with this. I'll be refining it down into some helper procs to reduce on code duplication and such git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3811 316c924e-a436-60f5-8080-3fe189b3f50e
208 lines
5.2 KiB
Plaintext
208 lines
5.2 KiB
Plaintext
/*
|
|
CONTAINS:
|
|
DONUT BOX
|
|
EGG BOX
|
|
MONKEY CUBE BOX
|
|
|
|
*/
|
|
|
|
|
|
/mob/living/carbon/var/last_eating = 0
|
|
|
|
/obj/item/kitchen/donut_box
|
|
var/amount = 6
|
|
icon = 'food.dmi'
|
|
icon_state = "donutbox"
|
|
name = "donut box"
|
|
/obj/item/kitchen/egg_box
|
|
var/amount = 12
|
|
icon = 'food.dmi'
|
|
icon_state = "eggbox"
|
|
name = "egg box"
|
|
|
|
/obj/item/kitchen/donut_box/proc/update()
|
|
src.icon_state = text("donutbox[]", src.amount)
|
|
return
|
|
|
|
/*
|
|
/obj/item/kitchen/donut_box/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
if (istype(W, /obj/item/weapon/reagent_containers/food/snacks/donut) && (amount < 6))
|
|
user.drop_item()
|
|
W.loc = src
|
|
usr << "You place a donut back into the box."
|
|
src.update()
|
|
return
|
|
*/
|
|
|
|
/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
|
|
return
|
|
|
|
/obj/item/kitchen/donut_box/attack_paw(mob/user as mob)
|
|
return src.attack_hand(user)
|
|
|
|
/obj/item/kitchen/donut_box/attack_hand(mob/user as mob, unused, flag)
|
|
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()
|
|
return
|
|
|
|
/obj/item/kitchen/donut_box/examine()
|
|
set src in oview(1)
|
|
|
|
src.amount = round(src.amount)
|
|
var/n = src.amount
|
|
for(var/obj/item/weapon/reagent_containers/food/snacks/donut/P in src)
|
|
n++
|
|
if (n <= 0)
|
|
n = 0
|
|
usr << "There are no donuts left in the box."
|
|
else
|
|
if (n == 1)
|
|
usr << "There is one donut left in the box."
|
|
else
|
|
usr << text("There are [] donuts in the box.", n)
|
|
return
|
|
|
|
/obj/item/kitchen/egg_box/proc/update()
|
|
src.icon_state = text("eggbox[]", src.amount)
|
|
return
|
|
|
|
|
|
/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
|
|
return
|
|
|
|
/obj/item/kitchen/egg_box/attack_paw(mob/user as mob)
|
|
return src.attack_hand(user)
|
|
|
|
/obj/item/kitchen/egg_box/attack_hand(mob/user as mob, unused, flag)
|
|
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()
|
|
return
|
|
|
|
/obj/item/kitchen/egg_box/examine()
|
|
set src in oview(1)
|
|
|
|
src.amount = round(src.amount)
|
|
var/n = src.amount
|
|
for(var/obj/item/weapon/reagent_containers/food/snacks/egg/P in src)
|
|
n++
|
|
if (n <= 0)
|
|
n = 0
|
|
usr << "There are no eggs left in the box."
|
|
else
|
|
if (n == 1)
|
|
usr << "There is one egg left in the box."
|
|
else
|
|
usr << text("There are [] eggs in the box.", n)
|
|
return
|
|
|
|
/obj/item/weapon/monkeycube_box
|
|
name = "monkey cube box"
|
|
desc = "Drymate brand monkey cubes. Just add water!"
|
|
icon = 'food.dmi'
|
|
icon_state = "monkeycubebox"
|
|
var/amount = 2
|
|
|
|
attack_hand(mob/user as mob, unused, flag)
|
|
add_fingerprint(user)
|
|
|
|
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 << "You take a monkey cube out of the box."
|
|
amount--
|
|
else
|
|
user << "There are no monkey cubes left in the box."
|
|
else
|
|
..()
|
|
|
|
return
|
|
|
|
attack_paw(mob/user as mob)
|
|
return attack_hand(user) |