Files
Paradise/code/game/objects/items/weapons/wrappingpaper.dm
elly1989@rocketmail.com 8961bd96d0 WARNING: This has been thoroughly tested and I'm happy that it's -stable- (it shouldn't runtime). However, it might have a few niggly bugs caused by specific items using no-standard or weird code. Most bugs will be stuff like it not updating overlays and such and can be fixed simply by dropping the item. That being said, if you're not comfortable with this, I'd suggest waiting to update past this revision.
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
2012-06-13 19:03:25 +00:00

242 lines
6.0 KiB
Plaintext

/*
CONTAINS:
WRAPPING PAPER
GIFTS
BEDSHEET BIN
PHOTOGRAPHS
*/
// WRAPPING PAPER
/obj/item/weapon/wrapping_paper/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if (!( locate(/obj/structure/table, src.loc) ))
user << "\blue You MUST put the paper on a table!"
if (W.w_class < 4)
if ((istype(user.l_hand, /obj/item/weapon/wirecutters) || istype(user.r_hand, /obj/item/weapon/wirecutters)))
var/a_used = 2 ** (src.w_class - 1)
if (src.amount < a_used)
user << "\blue You need more paper!"
return
else
src.amount -= a_used
user.drop_item()
var/obj/item/weapon/gift/G = new /obj/item/weapon/gift( src.loc )
G.size = W.w_class
G.w_class = G.size + 1
G.icon_state = text("gift[]", G.size)
G.gift = W
W.loc = G
G.add_fingerprint(user)
W.add_fingerprint(user)
src.add_fingerprint(user)
if (src.amount <= 0)
new /obj/item/weapon/c_tube( src.loc )
//SN src = null
del(src)
return
else
user << "\blue You need scissors!"
else
user << "\blue The object is FAR too large!"
return
/obj/item/weapon/wrapping_paper/examine()
set src in oview(1)
..()
usr << text("There is about [] square units of paper left!", src.amount)
return
/obj/item/weapon/wrapping_paper/attack(mob/target as mob, mob/user as mob)
if (!istype(target, /mob/living/carbon/human)) return
if (istype(target:wear_suit, /obj/item/clothing/suit/straight_jacket) || target:stat)
if (src.amount > 2)
var/obj/effect/spresent/present = new /obj/effect/spresent (target:loc)
src.amount -= 2
if (target:client)
target:client:perspective = EYE_PERSPECTIVE
target:client:eye = present
target:loc = present
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been wrapped with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to wrap [target.name] ([target.ckey])</font>")
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."
else
user << "Theyre moving around too much. a Straitjacket would help."
// 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()
else
user.r_hand = src.gift
user.update_inv_r_hand()
src.gift.layer = 20
src.gift.add_fingerprint(user)
del(src)
return
/obj/item/weapon/a_gift/ex_act()
del(src)
return
/obj/effect/spresent/relaymove(mob/user as mob)
if (user.stat)
return
user << "\blue You cant move."
/obj/effect/spresent/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if (!istype(W, /obj/item/weapon/wirecutters))
user << "/blue I need wirecutters for that."
return
user << "\blue You cut open the present."
for(var/mob/M in src) //Should only be one but whatever.
M.loc = src.loc
if (M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE
del(src)
/obj/item/weapon/a_gift/attack_self(mob/M as mob)
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
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
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
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
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
W.add_fingerprint(M)
//SN src = null
del(src)
return
else
return
// BEDSHEET BIN
/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
/obj/structure/bedsheetbin/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/bedsheetbin/attack_hand(mob/user as mob)
if (src.amount >= 1)
src.amount--
new /obj/item/weapon/bedsheet( src.loc )
add_fingerprint(user)
/obj/structure/bedsheetbin/examine()
set src in oview(1)
src.amount = round(src.amount)
if (src.amount <= 0)
src.amount = 0
usr << "There are no bed sheets in the bin."
else
if (src.amount == 1)
usr << "There is one bed sheet in the bin."
else
usr << text("There are [] bed sheets in the bin.", src.amount)
return
// PHOTOGRAPH
/obj/item/weapon/paper/photograph/New()
..()
src.pixel_y = 0
src.pixel_x = 0
return
/obj/item/weapon/paper/photograph/attack_self(mob/user as mob)
var/n_name = copytext(sanitize(input(user, "What would you like to label the photo?", "Paper Labelling", null) as text),1,32)
if ((src.loc == user && user.stat == 0))
src.name = text("photo[]", (n_name ? text("- '[]'", n_name) : null))
src.add_fingerprint(user)
return