Files
Paradise/code/game/objects/items/weapons/wrappingpaper.dm
T
Erthilo 6e289dabfc TG: Sanitized a large number of input()s.
- Hopefully this will cut down on the server spamming/crashing escapades
happening on other servers. (This wont stop that from happening, this just makes
it less severe)
- Some of the sanitizes were probably unnecessary, but better safe then sorry.

Added MAX_NAME_LEN constant which is initialized to 26.
- Please use MAX_NAME_LEN instead of typing in 26 when cutting inputs short.
26's are annoying when they have to be changed and you have to hunt through over
a hundred files and tens of thousands of lines of code to find them all.

Moved uplink_kits.dm to code/game/objects/storage

Moved uplinks.dm to code/game/objects
- The stuff inside uplinks.dm could really be chopped up and split into separate
dm files but this will do for now.

*********************************************************
**********************Important**************************
*********************************************************
When you create code that asks the user for an input consider whether or not it
gets shown to the user through html or the like.

If it does please sanatize() or strip_html() it. Also use copytext() to cutoff
spam by using MAX_NAME_LEN and MAX_MESSAGE_LEN as the cutoff var.
Revision: r3652
Author: 	 johnsonmt88
2012-05-26 00:09:56 +01:00

230 lines
5.5 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
else
user.r_hand = src.gift
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
else
M.r_hand = W
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
else
M.r_hand = W
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
else
M.r_hand = W
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
else
M.r_hand = W
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
else
M.r_hand = W
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