Skip to content

Commit

Permalink
[MIRROR] Improves Giftwrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbassil authored and SierraHelper committed Oct 11, 2023
1 parent 2db241f commit 1e3aa31
Show file tree
Hide file tree
Showing 30 changed files with 549 additions and 303 deletions.
3 changes: 2 additions & 1 deletion baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@
#include "code\game\objects\items\weapons\extinguisher.dm"
#include "code\game\objects\items\weapons\flame.dm"
#include "code\game\objects\items\weapons\flamethrower.dm"
#include "code\game\objects\items\weapons\gift_wrappaper.dm"
#include "code\game\objects\items\weapons\gifts.dm"
#include "code\game\objects\items\weapons\handcuffs.dm"
#include "code\game\objects\items\weapons\janitor_sign.dm"
#include "code\game\objects\items\weapons\lighter.dm"
Expand Down Expand Up @@ -1067,6 +1067,7 @@
#include "code\game\objects\items\weapons\trays.dm"
#include "code\game\objects\items\weapons\weaponry.dm"
#include "code\game\objects\items\weapons\weldbackpack.dm"
#include "code\game\objects\items\weapons\wrapping_paper.dm"
#include "code\game\objects\items\weapons\candle\candle.dm"
#include "code\game\objects\items\weapons\candle\incense.dm"
#include "code\game\objects\items\weapons\candle\scent_decls.dm"
Expand Down
4 changes: 2 additions & 2 deletions code/datums/supplypacks/nonessent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/obj/item/device/camera,
/obj/item/device/camera_film = 2,
/obj/item/storage/photo_album,
/obj/item/stack/package_wrap/twenty_five,
/obj/item/stack/package_wrap/cargo_wrap,
/obj/item/reagent_containers/glass/paint/red,
/obj/item/reagent_containers/glass/paint/green,
/obj/item/reagent_containers/glass/paint/blue,
Expand All @@ -23,7 +23,7 @@
/obj/item/reagent_containers/glass/paint/black,
/obj/item/reagent_containers/glass/paint/white,
/obj/item/contraband/poster,
/obj/item/wrapping_paper = 3)
/obj/item/stack/package_wrap/gift_wrap)
cost = 10
containername = "arts and Crafts crate"

Expand Down
8 changes: 7 additions & 1 deletion code/datums/supplypacks/supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@

/singleton/hierarchy/supply_pack/supply/wpaper
name = "Cargo - Wrapping paper"
contains = list(/obj/item/stack/package_wrap/twenty_five = 3)
contains = list(/obj/item/stack/package_wrap/cargo_wrap = 3)
cost = 10
containername = "wrapping paper"

/singleton/hierarchy/supply_pack/supply/gpaper
name = "Cargo - Gift Wrapping paper"
contains = list(/obj/item/stack/package_wrap/gift_wrap = 3)
cost = 10
containername = "gift wrapping paper"

/singleton/hierarchy/supply_pack/supply/tapes
name = "Medium - Blank Tapes (14)"
contains = list (/obj/item/storage/box/tapes)
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/vending/games.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
/obj/item/storage/box/checkers = 10,
/obj/item/storage/box/checkers/chess/red = 10,
/obj/item/storage/box/checkers/chess = 10,
/obj/item/stack/package_wrap/gift_wrap = 10,
/obj/item/board = 2,
/obj/item/storage/fancy/crayons = 3,
/obj/item/reagent_containers/spray/waterflower = 10,
Expand All @@ -51,6 +52,7 @@
/obj/item/storage/box/checkers = 0,
/obj/item/storage/box/checkers/chess/red = 0,
/obj/item/storage/box/checkers/chess = 0,
/obj/item/stack/package_wrap/gift_wrap = 0,
/obj/item/board = 0,
/obj/item/storage/fancy/crayons = 0,
/obj/item/reagent_containers/spray/waterflower = 0,
Expand Down
9 changes: 0 additions & 9 deletions code/game/objects/effects/misc.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
//The effect when you wrap a dead body in gift wrap
/obj/effect/spresent
name = "strange present"
desc = "It's a ... present?"
icon = 'icons/obj/gifts.dmi'
icon_state = "strangepresent"
density = TRUE
anchored = FALSE

/obj/effect/stop
var/victim = null
icon_state = "empty"
Expand Down
7 changes: 0 additions & 7 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,6 @@
else if (S.can_be_inserted(src, user))
S.handle_item_insertion(src)

/obj/item/use_on(obj/target, mob/user)
if (istype(target, /obj/item/clothing))
var/obj/item/clothing/clothes = target
if (clothes.attempt_store_item(src, user))
return TRUE
return ..()

/obj/item/can_embed()
if (!canremove)
return FALSE
Expand Down
118 changes: 66 additions & 52 deletions code/game/objects/items/weapons/gift_wrappaper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,71 +153,85 @@
var/amount = 2.5*BASE_STORAGE_COST(ITEM_SIZE_HUGE)
item_flags = ITEM_FLAG_TRY_ATTACK

/obj/item/wrapping_paper/attackby(obj/item/W as obj, mob/user as mob)
..()
if (!( locate(/obj/structure/table, src.loc) ))
to_chat(user, SPAN_WARNING("You MUST put the paper on a table!"))
if (W.w_class < ITEM_SIZE_HUGE)
var/is_wirecutter = FALSE
for (var/obj/item as anything in user.GetAllHeld())
if (isWirecutter(item))
is_wirecutter = TRUE
break
if (is_wirecutter)
var/a_used = W.get_storage_cost()
if (a_used == ITEM_SIZE_NO_CONTAINER)
to_chat(user, SPAN_WARNING("You can't wrap that!"))//no gift-wrapping lit welders

return
if (src.amount < a_used)
to_chat(user, SPAN_WARNING("You need more paper!"))
return
else
if(istype(W, /obj/item/smallDelivery) || istype(W, /obj/item/gift)) //No gift wrapping gifts!
return

if(user.unEquip(W))
var/obj/item/gift/G = new /obj/item/gift( src.loc, W )
G.add_fingerprint(user)
W.add_fingerprint(user)
src.amount -= a_used

if (src.amount <= 0)
new /obj/item/c_tube( src.loc )
qdel(src)
return
else
to_chat(user, SPAN_WARNING("You need scissors!"))
else
to_chat(user, SPAN_WARNING("The object is FAR too large!"))
return
/obj/item/wrapping_paper/use_tool(obj/item/tool, mob/user)
if (!istype(tool))
return FALSE
if (!isturf(loc))
to_chat(user, SPAN_WARNING("You must put \the [src] on a surface in order to wrap \the [tool]!"))
return TRUE
if (tool.w_class > ITEM_SIZE_LARGE)
to_chat(user, SPAN_WARNING("\The [tool] is far too large!"))
return TRUE
if (!is_sharp(user.get_inactive_hand()))
to_chat(user, SPAN_WARNING("You need a sharp object in your other hand to cut \the [src]!"))
return TRUE

var/a_used = tool.get_storage_cost()
if (a_used == ITEM_SIZE_NO_CONTAINER)
to_chat(user, SPAN_WARNING("You can't wrap that!"))
return TRUE
if (amount < a_used)
to_chat(user, SPAN_WARNING("You need more paper!"))
return TRUE
if (istype(tool, /obj/item/smallDelivery) || istype(tool, /obj/item/gift)) //No gift wrapping gifts!
to_chat(user, SPAN_WARNING("\The [tool] is already wrapped!"))
return TRUE
if (!do_after(user, tool.w_class SECONDS, tool, DO_PUBLIC_UNIQUE))
return TRUE

if (user.unEquip(tool))
var/obj/item/gift/G = new /obj/item/gift(loc, tool)
G.add_fingerprint(user)
tool.add_fingerprint(user)
amount -= a_used

if (amount <= 0)
new /obj/item/c_tube(loc)
qdel(src)
return TRUE

/obj/item/wrapping_paper/use_on(obj/item/target, mob/user)
if (!isitem(target))
return FALSE
if (!isturf(loc))
to_chat(user, SPAN_WARNING("You must put \the [src] on a surface in order to wrap \the [target]!"))
return TRUE

/obj/item/wrapping_paper/examine(mob/user, distance)
. = ..()
if(distance <= 1)
to_chat(user, text("There is about [] square units of paper left!", src.amount))

/obj/item/wrapping_paper/attack(mob/target as mob, mob/user as mob)
. = FALSE
if (!istype(target, /mob/living/carbon/human))
return FALSE

var/mob/living/carbon/human/H = target
if (istype(H.wear_suit, /obj/item/clothing/suit/straight_jacket) || H.stat)
if (src.amount > 2)
var/obj/effect/spresent/present = new /obj/effect/spresent (H.loc)
src.amount -= 2
var/a_used = BASE_STORAGE_COST(ITEM_SIZE_LARGE) //get_storage_cost() does not work on mobs, will reproduce same logic here.

if (H.client)
H.client.perspective = EYE_PERSPECTIVE
H.client.eye = present
if (amount < a_used)
to_chat(user, SPAN_WARNING("You need more paper."))
return TRUE

H.forceMove(present)
admin_attack_log(user, H, "Used \a [src] to wrap their victim", "Was wrapepd with \a [src]", "used \the [src] to wrap")
if (!H.has_danger_grab(user))
to_chat(user, "You need to have a firm grip on \the [target] in order to wrap them.")
return TRUE

if (!do_after(user, ITEM_SIZE_LARGE SECONDS, target, DO_PUBLIC_UNIQUE) || !H.has_danger_grab(user))
return TRUE

else
to_chat(user, SPAN_WARNING("You need more paper."))
var/obj/effect/spresent/present = new /obj/effect/spresent (H.loc)
amount -= a_used

if (H.client)
H.client.perspective = EYE_PERSPECTIVE
H.client.eye = present

if (user == target)
user.visible_message(SPAN_DANGER("\The [user] has gift-wrapped themselves!"))
else
to_chat(user, "They are moving around too much. A straightjacket would help.")
user.visible_message(SPAN_DANGER("\The [user] has gift-wrapped \the [target]!"))

H.forceMove(present)
H.remove_grabs_and_pulls()
admin_attack_log(user, H, "Used \a [src] to wrap their victim", "Was wrapepd with \a [src]", "used \the [src] to wrap")
return TRUE
131 changes: 131 additions & 0 deletions code/game/objects/items/weapons/gifts.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/obj/item/a_gift
name = "gift"
desc = "PRESENTS!!!! eek!"
icon = 'icons/obj/parcels.dmi'
icon_state = "gift1"
item_state = "gift1"
randpixel = 10

/obj/item/a_gift/New()
..()
if(w_class > 0 && w_class < ITEM_SIZE_HUGE)
icon_state = "gift[w_class]"
else
icon_state = "gift[pick(1, 2, 3)]"
return

/obj/item/a_gift/ex_act()
qdel(src)
return

/obj/item/a_gift/attack_self(mob/M as mob)
var/gift_type = pick(
/obj/item/storage/wallet,
/obj/item/storage/photo_album,
/obj/item/storage/box/snappops,
/obj/item/storage/fancy/crayons,
/obj/item/storage/backpack/holding,
/obj/item/storage/belt/champion,
/obj/item/pickaxe/silver,
/obj/item/pen/invisible,
/obj/item/lipstick/random,
/obj/item/grenade/smokebomb,
/obj/item/carvable/corncob,
/obj/item/contraband/poster,
/obj/item/book/manual/barman_recipes,
/obj/item/book/manual/chef_recipes,
/obj/item/bikehorn,
/obj/item/beach_ball,
/obj/item/beach_ball/holoball,
/obj/item/toy/water_balloon,
/obj/item/toy/blink,
/obj/item/toy/crossbow,
/obj/item/gun/projectile/revolver/capgun,
/obj/item/toy/katana,
/obj/item/toy/prize/deathripley,
/obj/item/toy/prize/durand,
/obj/item/toy/prize/fireripley,
/obj/item/toy/prize/gygax,
/obj/item/toy/prize/honk,
/obj/item/toy/prize/marauder,
/obj/item/toy/prize/mauler,
/obj/item/toy/prize/odysseus,
/obj/item/toy/prize/phazon,
/obj/item/toy/prize/powerloader,
/obj/item/toy/prize/seraph,
/obj/item/toy/spinningtoy,
/obj/item/toy/sword,
/obj/item/reagent_containers/food/snacks/grown/ambrosiadeus,
/obj/item/reagent_containers/food/snacks/grown/ambrosiavulgaris,
/obj/item/device/paicard,
/obj/item/device/synthesized_instrument/violin,
/obj/item/storage/belt/utility/full,
/obj/item/clothing/accessory/horrible,
/obj/item/storage/box/large/foam_gun,
/obj/item/storage/box/large/foam_gun/burst,
/obj/item/storage/box/large/foam_gun/revolver)

if(!ispath(gift_type,/obj/item)) return

var/obj/item/I = new gift_type(M)
M.put_in_hands(I)
I.add_fingerprint(M)
qdel(src)

/*
* Special item for wrapped mobs
*/

/obj/effect/mobpresent
name = "strange gift"
desc = "It's a ... gift?"
icon = 'icons/obj/parcels.dmi'
icon_state = "strangegift"
density = TRUE
anchored = FALSE
var/package_type = "parcel"

/obj/effect/mobpresent/Initialize(mapload, target, wrap_type)
..(mapload)
if (!target || !ishuman(target) || !wrap_type)
return INITIALIZE_HINT_QDEL

var/mob/living/carbon/human/human = target
if (human.client)
human.client.perspective = EYE_PERSPECTIVE
human.client.eye = src

name = "strange [package_type]"
desc = "It's a ... [package_type]?"
package_type = wrap_type
update_icon()

/obj/effect/mobpresent/on_update_icon()
icon_state = "strange[package_type]"

/obj/effect/mobpresent/relaymove(mob/user as mob)
if (user.stat)
return
to_chat(user, SPAN_WARNING("You can't move."))


/obj/effect/mobpresent/use_tool(obj/item/tool, mob/user, list/click_params)
if (is_sharp(tool))
user.visible_message(
SPAN_NOTICE("\The [user] cuts open \the [src] with \a [tool]."),
SPAN_NOTICE("You cut open \the [src] with \the [tool].")
)
for (var/mob/M in src) //Should only be one but whatever.
M.dropInto(loc)
if (M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE
qdel(src)
return TRUE
return ..()

/obj/effect/mobpresent/attack_hand(mob/living/user)
to_chat(user, "You need a sharp tool to unwrap \the [src].")

/obj/effect/mobpresent/attack_robot(mob/living/silicon/robot/user)
to_chat(user, "You need a sharp tool to unwrap \the [src].")
8 changes: 4 additions & 4 deletions code/game/objects/items/weapons/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@

for(var/obj/item/storage/S in src)
L += S.return_inv()
for(var/obj/item/gift/G in src)
L += G.gift
if (istype(G.gift, /obj/item/storage))
L += G.gift:return_inv()
for(var/obj/item/smallDelivery/parcel in src)
L += parcel.wrapped
if (istype(parcel.wrapped, /obj/item/storage))
L += parcel.wrapped:return_inv()
return L

/obj/item/storage/proc/show_to(mob/user as mob)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/storage/uplink_kits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
// Clerical uplink kit
/obj/item/storage/backpack/satchel/syndie_kit/clerical
startswith = list(
/obj/item/stack/package_wrap/twenty_five,
/obj/item/stack/package_wrap/cargo_wrap,
/obj/item/hand_labeler,
/obj/item/stamp/chameleon,
/obj/item/pen/chameleon,
Expand Down
Loading

0 comments on commit 1e3aa31

Please sign in to comment.