Skip to content

Commit

Permalink
[MIRROR] Improvements to wrapping paper
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbassil authored and SuhEugene committed Dec 21, 2023
1 parent 0e2948b commit 4ac7e11
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 126 deletions.
92 changes: 0 additions & 92 deletions code/game/objects/items/weapons/gifts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,95 +71,3 @@
M.put_in_hands(I)
I.add_fingerprint(M)
qdel(src)

/*
* Special item for wrapped mobs
*/

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

/obj/structure/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/structure/mobpresent/on_update_icon()
icon_state = "strange[package_type]"

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

/obj/structure/mobpresent/proc/unwrap()
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)

/obj/structure/mobpresent/mob_breakout(mob/living/escapee)
. = ..()
if (!breakout_time)
breakout_time = 30 SECONDS
if (breakout)
return FALSE

. = TRUE
escapee.setClickCooldown(100)

to_chat(escapee, SPAN_WARNING("You start squirming inside \the [src] and start weakening the wrapping paper. (this will take about [breakout_time/(1 SECOND)] second\s)"))
visible_message(SPAN_DANGER("\The [src] begins to shake violently!"))
shake_animation()

var/stages = 3
breakout = TRUE
for (var/i = 1 to stages)
if (do_after(escapee, breakout_time*(1/stages), do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DEFAULT & ~INCAPACITATION_RESTRAINED))
to_chat(escapee, SPAN_WARNING("You try to slip free of \the [src] ([i*100/stages]% done)."))
else
to_chat(escapee, SPAN_WARNING("You stop trying to slip free of \the [src]."))
breakout = FALSE
return
shake_animation()

//Well then break it!
breakout = FALSE
to_chat(escapee, SPAN_WARNING("You successfully break out!"))
visible_message(SPAN_DANGER("\The [escapee] successfully broke out of \the [src]!"))
unwrap()

/obj/structure/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].")
)
unwrap()
return TRUE
return ..()

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

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

if (istype(target, /obj/structure/closet))
var/obj/structure/bigDelivery/parcel = new /obj/structure/bigDelivery(get_turf(target.loc), target, package_type)
var/obj/structure/bigDelivery/package/parcel = new /obj/structure/bigDelivery/package(get_turf(target.loc), target, package_type)
parcel.add_fingerprint(user)
amount_used = istype(target, /obj/structure/closet/crate) ? BASE_STORAGE_COST(ITEM_SIZE_NORMAL) : BASE_STORAGE_COST(ITEM_SIZE_LARGE)
else if (istype(target, /obj/item))
Expand All @@ -62,6 +62,7 @@
user.visible_message("\The [user] wraps \the [target] with [get_vague_name(TRUE)]].",
SPAN_NOTICE("You wrap \the [target] with [get_exact_name(amount_used)]"),
"You hear someone taping paper around an object.")
playsound(user.loc, 'sound/effects/wrap.ogg', 65, 1)

if (get_amount() <= 0)
new /obj/item/c_tube(loc)
Expand Down Expand Up @@ -145,7 +146,7 @@
if (!do_after(user, ITEM_SIZE_LARGE SECONDS, target, DO_PUBLIC_UNIQUE) || !H.has_danger_grab(user) || !user.use_sanity_check(H, src))
return TRUE

var/obj/structure/mobpresent/present = new (H.loc, H, package_type)
var/obj/structure/bigDelivery/mobpresent/present = new (H.loc, H, package_type)
use(a_used)

if (user == target)
Expand All @@ -159,7 +160,8 @@
SPAN_DANGER("You wrap \the [target] with [get_exact_name(a_used)].")
)

H.forceMove(present)
playsound(user.loc, 'sound/effects/wrap.ogg', 65, 1)
present.add_fingerprint(user)
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
5 changes: 4 additions & 1 deletion code/game/objects/structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,23 @@


/obj/structure/attack_hand(mob/user)
..()
if(MUTATION_FERAL in user.mutations)
attack_generic(user,10,"smashes")
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN*2)
attack_animation(user)
playsound(loc, 'sound/weapons/tablehit1.ogg', 40, 1)
return TRUE

if(breakable)
if(MUTATION_HULK in user.mutations)
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
attack_generic(user,1,"smashes")
return TRUE
else if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
if(H.species.can_shred(user))
attack_generic(user,1,"slices")
return TRUE
return ..()


Expand Down
161 changes: 132 additions & 29 deletions code/modules/recycling/sortingmachinery.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
///Parent object and procs to /obj/structure/bigDelivery/package and /obj/structure/bigDelivery/mobpresent
/obj/structure/bigDelivery
desc = "A big wrapped package."
name = "large parcel"
Expand All @@ -15,29 +16,14 @@
var/tag_x
var/package_type = "parcel"

/obj/structure/bigDelivery/Initialize(mapload, obj/structure/closet/parcel, wrap_type)
..(mapload)
if (!parcel || !istype(parcel) || !wrap_type)
return INITIALIZE_HINT_QDEL

wrapped = parcel
wrapped.forceMove(src)
package_type = wrap_type
SetName("large [package_type]")
desc = name
update_icon()

/obj/structure/bigDelivery/Destroy()
QDEL_NULL(wrapped)
return ..()


/obj/structure/bigDelivery/damage_health(damage, damage_type, damage_flags, severity, skip_can_damage_check)
. = ..()
// It's only paper. No protection for anything inside.
if (!length(contents))
return
var/content_damage = damage / length(contents)
for (var/atom/victim as anything in contents)
victim.damage_health(content_damage, damage_type, damage_flags, severity, skip_can_damage_check)
return ..()


/obj/structure/bigDelivery/on_death()
Expand All @@ -53,10 +39,22 @@
qdel_self()

/obj/structure/bigDelivery/attack_hand(mob/user as mob)
to_chat(user, "You need a sharp tool to unwrap \the [src].")
if (user.a_intent != I_HURT)
to_chat(user, "You need a sharp tool to unwrap \the [src].")
return
return ..()

/obj/structure/bigDelivery/attack_robot(mob/user)
to_chat(user, "You need a sharp tool to unwrap \the [src].")
if (user.a_intent != I_HURT)
to_chat(user, "You need a sharp tool to unwrap \the [src].")
return
return ..()

/obj/structure/bigDelivery/AddLabel(label, mob/user)
..()
if (!nameset)
nameset = TRUE
update_icon()

/obj/structure/bigDelivery/proc/unwrap(mob/user)
if(Adjacent(user))
Expand Down Expand Up @@ -123,8 +121,28 @@

return ..()

/obj/structure/bigDelivery/examine(mob/user, distance)
. = ..()
if(distance <= 4)
if(sortTag)
to_chat(user, SPAN_NOTICE("It is labeled \"[sortTag]\""))
if(examtext)
to_chat(user, SPAN_NOTICE("It has a note attached which reads, \"[examtext]\""))

///Procs exclusive to the package subtype.
/obj/structure/bigDelivery/package/Initialize(mapload, obj/structure/closet/parcel, wrap_type)
..(mapload)
if (!parcel || !istype(parcel) || !wrap_type)
return INITIALIZE_HINT_QDEL

/obj/structure/bigDelivery/on_update_icon()
wrapped = parcel
wrapped.forceMove(src)
package_type = wrap_type
SetName("large [package_type]")
desc = name
update_icon()

/obj/structure/bigDelivery/package/on_update_icon()
ClearOverlays()
if (istype(wrapped, /obj/structure/closet/crate))
icon_state = "[package_type]crate"
Expand Down Expand Up @@ -158,14 +176,6 @@
I.pixel_y = -3
AddOverlays(I)

/obj/structure/bigDelivery/examine(mob/user, distance)
. = ..()
if(distance <= 4)
if(sortTag)
to_chat(user, SPAN_NOTICE("It is labeled \"[sortTag]\""))
if(examtext)
to_chat(user, SPAN_NOTICE("It has a note attached which reads, \"[examtext]\""))

/obj/structure/bigDelivery/Destroy()
if(wrapped) //sometimes items can disappear. For example, bombs. --rastaf0
wrapped.dropInto(loc)
Expand All @@ -176,8 +186,94 @@
var/turf/T = get_turf(src)
for(var/atom/movable/AM in contents)
AM.forceMove(T)
playsound(loc, 'sound/effects/wrap_tear.ogg', 65, 1)
return ..()

///Procs exclusive to mopresent subtype.
/obj/structure/bigDelivery/mobpresent
name = "strange gift"
desc = "It's a ... gift?"
icon_state = "strangegift"
breakout_time = 30 SECONDS

/obj/structure/bigDelivery/mobpresent/Initialize(mapload, mob/living/carbon/human/parcel, wrap_type)
..(mapload)
if (!parcel || !istype(parcel) || !wrap_type)
return INITIALIZE_HINT_QDEL

wrapped = parcel
wrapped.forceMove(src)
package_type = wrap_type
if (parcel.client)
parcel.client.perspective = EYE_PERSPECTIVE
parcel.client.eye = src

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

/obj/structure/bigDelivery/mobpresent/on_update_icon()
ClearOverlays()
icon_state = "strange[package_type]"
if (nameset || examtext)
var/image/I = new/image('icons/obj/parcels.dmi',"delivery_label")
I.pixel_x = 2
if (label_y == null)
label_y = rand (2,5)
I.pixel_y = label_y
AddOverlays(I)

if (sortTag)
var/image/I = new/image('icons/obj/parcels.dmi',"delivery_tag")
if (tag_x == null)
tag_x = 0
I.pixel_x = tag_x
I.pixel_y = 0
AddOverlays(I)

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

/obj/structure/bigDelivery/mobpresent/on_death()
. = ..()
for (var/mob/M in src) //Should only be one but whatever.
if (M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE

/obj/structure/bigDelivery/mobpresent/mob_breakout(mob/living/escapee)
. = ..()
if (!breakout_time)
breakout_time = 30 SECONDS
if (breakout)
return FALSE

. = TRUE
escapee.setClickCooldown(100)

to_chat(escapee, SPAN_WARNING("You start squirming inside \the [src] and start weakening the wrapping paper. (this will take about [breakout_time/(1 SECOND)] second\s)"))
visible_message(SPAN_DANGER("\The [src] begins to shake violently!"))
shake_animation()

var/stages = 3
breakout = TRUE
for (var/i = 1 to stages)
if (do_after(escapee, breakout_time*(1/stages), do_flags = DO_DEFAULT | DO_USER_UNIQUE_ACT, incapacitation_flags = INCAPACITATION_DEFAULT & ~INCAPACITATION_RESTRAINED))
to_chat(escapee, SPAN_WARNING("You try to slip free of \the [src] ([i*100/stages]% done)."))
else
to_chat(escapee, SPAN_WARNING("You stop trying to slip free of \the [src]."))
breakout = FALSE
return
shake_animation()

//Well then break it!
breakout = FALSE
to_chat(escapee, SPAN_WARNING("You successfully break out!"))
visible_message(SPAN_DANGER("\The [escapee] successfully broke out of \the [src]!"))
unwrap()

/obj/item/smallDelivery
name = "small parcel"
desc = "A small parcel."
Expand Down Expand Up @@ -210,6 +306,7 @@
update_icon()

/obj/item/smallDelivery/Destroy()
playsound(loc, 'sound/effects/wrap_tear.ogg', 65, 1)
QDEL_NULL(wrapped)
return ..()

Expand Down Expand Up @@ -350,6 +447,12 @@
I.pixel_y = -3
AddOverlays(I)

/obj/item/smallDelivery/AddLabel(label, mob/user)
..()
if (!nameset)
nameset = TRUE
update_icon()

/obj/item/smallDelivery/examine(mob/user, distance)
. = ..()
if(distance <= 4)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/spells/artifacts/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/obj/structure/closet/wizard/New()
..()
var/obj/structure/bigDelivery/package = new /obj/structure/bigDelivery(get_turf(src))
var/obj/structure/bigDelivery/package/package = new /obj/structure/bigDelivery/package(get_turf(src))
package.wrapped = src
package.examtext = "Imported straight from the Wizard Acadamy. Do not lose the contents or suffer a demerit."
src.forceMove(package)
Expand Down
Binary file added sound/effects/wrap.ogg
Binary file not shown.
Binary file added sound/effects/wrap_tear.ogg
Binary file not shown.

0 comments on commit 4ac7e11

Please sign in to comment.