Enabling gift-based RP (#7598)

This commit is contained in:
Doxxmedearly
2019-12-08 04:48:51 -06:00
committed by Werner
parent 46b71576a3
commit 74ddd892ee
2 changed files with 73 additions and 30 deletions

View File

@@ -3,47 +3,48 @@
desc = "You can use this to wrap items in."
icon = 'icons/obj/stacks/wrap.dmi'
icon_state = "wrap_paper"
singular_name = "square unit"
amount = 20.0
/obj/item/stack/wrapping_paper/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/stack/wrapping_paper/attackby(obj/item/W, mob/user)
..()
if (!( locate(/obj/structure/table, src.loc) ))
to_chat(user, "<span class='warning'>You MUST put the paper on a table!</span>")
if (!isturf(loc))
to_chat(user, span("warning", "The paper must be set down for you to wrap a gift!"))
return
if (W.w_class < 4)
if ((istype(user.l_hand, /obj/item/wirecutters) || istype(user.r_hand, /obj/item/wirecutters)))
var/a_used = 2 ** (src.w_class - 1)
if (src.amount < a_used)
to_chat(user, "<span class='warning'>You need more paper!</span>")
return
else
if(istype(W, /obj/item/smallDelivery) || istype(W, /obj/item/gift)) //No gift wrapping gifts!
return
src.amount -= a_used
user.drop_item()
var/obj/item/gift/G = new /obj/item/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.forceMove(G)
G.add_fingerprint(user)
W.add_fingerprint(user)
src.add_fingerprint(user)
if (src.amount <= 0)
new /obj/item/c_tube( src.loc )
qdel(src)
return
var/a_used = 2 * (src.w_class - 1)
if (src.amount < a_used)
to_chat(user, span("warning", "You need more paper!"))
return
else
to_chat(user, "<span class='warning'>You need scissors!</span>")
if(istype(W, /obj/item/smallDelivery) || istype(W, /obj/item/gift)) //No gift wrapping gifts!
return
src.amount -= a_used
user.drop_item()
var/obj/item/gift/G = new /obj/item/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.forceMove(G)
G.add_fingerprint(user)
W.add_fingerprint(user)
src.add_fingerprint(user)
if (src.amount <= 0)
new /obj/item/c_tube(src.loc)
qdel(src)
return
else
to_chat(user, "<span class='warning'>The object is FAR too large!</span>")
to_chat(user, span("warning", "This object is far too large to wrap!"))
return
/obj/item/stack/wrapping_paper/examine(mob/user)
if(..(user, 1))
to_chat(user, text("There is about [] square units of paper left!", src.amount))
to_chat(user, "There [amount == 1 ? "is" : "are"] about [amount] [singular_name]\s of paper left!")
/obj/item/stack/wrapping_paper/attack(mob/target as mob, mob/user as mob)
if (!istype(target, /mob/living/carbon/human)) return