Files
vgstation13/code/game/objects/items/weapons/gift_wrappaper.dm
ShiftyRail fa42b8cca8 Some fixes for wrapper code (#37525)
* Some fixes for wrapper code

* linter
2025-05-06 09:03:20 -04:00

367 lines
11 KiB
Plaintext

/* Gifts and wrapping paper
* Contains:
* Gifts
* Winter Gifts
* Strange Presents
*/
////WRAPPED GIFTS////
/obj/item/weapon/gift
name = "gift"
desc = "A wrapped item."
icon = 'icons/obj/items.dmi'
icon_state = "gift"
item_state = "gift"
var/size = 3.0
var/obj/item/gift = null
w_class = W_CLASS_MEDIUM
w_type = RECYK_WOOD
flammable = TRUE
/obj/item/weapon/gift/New(turf/loc, var/obj/item/target, var/W)
..()
w_class = W
gift = target
update_icon()
/obj/item/weapon/gift/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/pen))
var/str = copytext(sanitize(input(user,"What should the label read? (max 52 characters)","Write a personal message!","") as message|null),1,MAX_NAME_LEN * 2)
if (!Adjacent(user) || user.stat)
return
if(!str || !length(str))
to_chat(user, "<span class='warning'>You clear the label.</span>")
src.desc = "A wrapped item."
return
to_chat(user, "<span class='notice'>You write [str] on the label.</span>")
src.desc = "A wrapped item. The label reads: [str]"
log_admin("[user.key]/([user.name]) tagged a gift with \"[str]\" at [get_turf(user)]")
/obj/item/weapon/gift/update_icon()
switch(w_class)
if(W_CLASS_TINY,W_CLASS_SMALL)
icon_state = "gift-small"
item_state = "gift-small"
if(W_CLASS_MEDIUM)
icon_state = "gift"
item_state = "gift"
if(W_CLASS_LARGE)
icon_state = "gift-large"
item_state = "gift-large"
/obj/item/weapon/gift/attack_self(mob/user)
user.drop_item(src, force_drop = 1)
if(gift)
user.put_in_active_hand(gift)
gift.add_fingerprint(user)
to_chat(user, "<span class='notice'>You unwrapped \a [gift]!</span>")
else
to_chat(user, "<span class='notice'>The gift was empty!</span>")
for (var/obj/item/I in contents)
I.forceMove(get_turf(user))
qdel(src)
return
/obj/item/weapon/gift/ashify()//so the content of player-made gifts can be recovered.
if(gift)
gift.forceMove(get_turf(src))
..()
////WINTER GIFTS////
/obj/item/weapon/winter_gift
name = "gift"
desc = ""
icon = 'icons/obj/items.dmi'
icon_state = "gift"
item_state = "gift"
w_class = W_CLASS_LARGE
w_type = RECYK_WOOD
flammable = TRUE
/obj/item/weapon/winter_gift/New()
..()
pixel_x = rand(-10,10) * PIXEL_MULTIPLIER
pixel_y = rand(-10,10) * PIXEL_MULTIPLIER
/obj/item/weapon/winter_gift/ex_act()
qdel(src)
return
/obj/item/weapon/winter_gift/regular
desc = "What are you waiting for? Tear that paper apart!"
icon_state = "gift_winter-1"
item_state = "gift_winter-1"
/obj/item/weapon/winter_gift/food
desc = "That one smells really good!"
icon_state = "gift_winter-2"
item_state = "gift_winter-2"
/obj/item/weapon/winter_gift/cloth
desc = "That one feels warm to the touch!"
icon_state = "gift_winter-3"
item_state = "gift_winter-3"
/obj/item/weapon/winter_gift/special
desc = "There is something eerie about that one...opening it might or might not be a good idea."
icon_state = "gift_winter-4"
item_state = "gift_winter-4"
/obj/item/weapon/winter_gift/attack_self(mob/M as mob)
to_chat(M, "<span class='notice'>The gift was empty!</span>")
M.u_equip(src,0)
qdel(src)
return
/obj/item/weapon/winter_gift/regular/attack_self(mob/M as mob)
var/gift_type = pick(
/obj/item/weapon/sord,
/obj/item/weapon/storage/wallet,
/obj/item/device/camera,
/obj/item/device/camera/sepia,
/obj/item/weapon/storage/photo_album,
/obj/item/weapon/storage/box/snappops,
/obj/item/weapon/storage/fancy/crayons,
/obj/item/weapon/storage/backpack/holding,
/obj/item/weapon/storage/belt/champion,
/obj/item/weapon/soap/deluxe,
/obj/item/weapon/pickaxe/silver,
/obj/item/weapon/pen/invisible,
/obj/item/weapon/lipstick/random,
/obj/item/weapon/grenade/smokebomb,
// /obj/item/weapon/corncob,
/obj/item/mounted/poster,
// /obj/item/weapon/book/manual/barman_recipes, //we're in December 2014 and those books are still empty
// /obj/item/weapon/book/manual/chef_recipes,
/obj/item/weapon/bikehorn,
/obj/item/weapon/beach_ball,
// /obj/item/weapon/beach_ball/holoball,
/obj/item/weapon/banhammer,
/obj/item/toy/waterballoon,
// /obj/item/toy/blink, //this one reaaally needs a revamp. there's a limit to how lame a toy can be.
/obj/item/toy/crossbow,
/obj/item/toy/gun,
/obj/item/toy/bomb,
/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/ripley,
/obj/item/toy/prize/seraph,
/obj/item/toy/spinningtoy,
/obj/item/toy/sword,
/obj/item/clothing/mask/cigarette/blunt/deus,
/obj/item/clothing/mask/cigarette/blunt/cruciatus,
/obj/item/device/paicard,
/obj/item/device/instrument/violin,
/obj/item/weapon/storage/belt/utility/complete,
/obj/item/clothing/accessory/tie/horrible,
/obj/item/device/maracas,
/obj/item/weapon/gun/energy/temperature,
/obj/item/weapon/pickaxe/shovel,
/obj/item/clothing/shoes/galoshes,
)
var/obj/item/I = new gift_type(M)
M.u_equip(src,0)
M.put_in_hands(I)
I.add_fingerprint(M)
to_chat(M, "<span class='notice'>You unwrapped \a [I]!</span>")
qdel(src)
return
//christmas and festive food
/obj/item/weapon/winter_gift/food/attack_self(mob/M as mob)
var/gift_type = pick(
/obj/item/weapon/reagent_containers/food/snacks/sliceable/birthdaycake,
/obj/item/weapon/reagent_containers/food/snacks/sliceable/buchedenoel,
/obj/item/weapon/reagent_containers/food/snacks/sliceable/turkey,
)
var/obj/item/I = new gift_type(M)
M.u_equip(src,0)
M.put_in_hands(I)
I.add_fingerprint(M)
to_chat(M, "<span class='notice'>You unwrapped \a [I]! Tasty!</span>")
qdel(src)
return
//warm clothes
/obj/item/weapon/winter_gift/cloth/attack_self(mob/M as mob)
if(prob(30))
cloth_bundle()
to_chat(M, "<span class='notice'>You unwrapped a bundle of clothes! Looks comfy!</span>")
qdel(src)
return
var/gift_type = pick(
/obj/item/clothing/gloves/black,
/obj/item/clothing/head/ushanka,
/obj/item/clothing/head/bearpelt,
)
var/obj/item/I = new gift_type(M)
M.u_equip(src,0)
M.put_in_hands(I)
I.add_fingerprint(M)
to_chat(M, "<span class='notice'>You unwrapped \a [I]! Looks comfy!</span>")
qdel(src)
return
/obj/item/weapon/winter_gift/cloth/proc/cloth_bundle()
var/bundle = pick(
3;"batman",
10;"russian fur",
10;"chicken",
8;"pirate captain",
2;"cuban pete"
)
switch(bundle)
if("batman")
new /obj/item/weapon/storage/belt/security/batmanbelt(get_turf(loc))
new /obj/item/clothing/head/batman(get_turf(loc))
new /obj/item/clothing/gloves/batmangloves(get_turf(loc))
new /obj/item/clothing/shoes/jackboots/batmanboots(get_turf(loc))
new /obj/item/clothing/under/batmansuit(get_turf(loc))
if("russian fur")
new /obj/item/clothing/suit/russofurcoat(get_turf(loc))
new /obj/item/clothing/head/russofurhat(get_turf(loc))
if("chicken")
new /obj/item/clothing/head/chicken(get_turf(loc))
new /obj/item/clothing/suit/chickensuit(get_turf(loc))
if("pirate captain")
new /obj/item/clothing/glasses/eyepatch(get_turf(loc))
new /obj/item/clothing/head/hgpiratecap(get_turf(loc))
new /obj/item/clothing/suit/hgpirate(get_turf(loc))
new /obj/item/clothing/under/captain_fly(get_turf(loc))
new /obj/item/clothing/shoes/jackboots(get_turf(loc))
if("cuban pete")
new /obj/item/clothing/head/collectable/petehat(get_turf(loc))
new /obj/item/device/maracas(get_turf(loc))
new /obj/item/device/maracas(get_turf(loc))
//dangerous items
/obj/item/weapon/winter_gift/special/attack_self(mob/M as mob)
var/gift_type = pick(
/obj/item/cannonball/fuse_bomb,
/obj/item/weapon/card/emag,
/obj/item/weapon/reagent_containers/food/snacks/grown/apple/poisoned,
/obj/item/weapon/tome_legacy,
)
var/obj/item/I = new gift_type(M)
M.u_equip(src,0)
M.put_in_hands(I)
I.add_fingerprint(M)
var/additional_info = ""
if(istype(I,/obj/item/cannonball/fuse_bomb))
var/obj/item/cannonball/fuse_bomb/B = I
B.fuse_lit = 1
B.update_icon()
B.fuse_burn()
additional_info = ", OH SHIT its fuse is lit!"
var/log_str = "[M.name]([M.ckey]) openned <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[I.x];Y=[I.y];Z=[I.z]'>a black gift</a> and found [I.name] inside[additional_info]."
if(M)
log_str += "(<A HREF='?_src_=holder;adminmoreinfo=\ref[M]'>?</A>)"
message_admins(log_str, 0, 1)
log_game(log_str)
to_chat(M, "<span class='notice'>You unwrapped \a [I][additional_info]!</span>")
qdel(src)
return
//black gifts have 2% chance to spawn by default.
/obj/item/weapon/winter_gift/proc/pick_a_gift(var/turf/T,var/special_chance = 2)
var/gift_type = pick(
50;/obj/item/weapon/winter_gift/regular,
25;/obj/item/weapon/winter_gift/food,
25;/obj/item/weapon/winter_gift/cloth,
special_chance;/obj/item/weapon/winter_gift/special,
)
new gift_type(T)
////STRANGE PRESENTS////
/obj/structure/strange_present
name = "strange present"
desc = "It's a ... present?"
icon = 'icons/obj/items.dmi'
icon_state = "strangepresent"
density = 1
anchored = 0
w_type=NOT_RECYCLABLE
/obj/structure/strange_present/Destroy()
for(var/atom/movable/AM in contents)
AM.forceMove(get_turf(src))
..()
/obj/structure/strange_present/relaymove(mob/user as mob)
if (user.stat)
return
to_chat(user, "<span class='notice'>You can't move.</span>")
/obj/structure/strange_present/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (W.is_wirecutter(user))
to_chat(user, "<span class='notice'>You cut open the present.</span>")
for(var/mob/M in src) //Should only be one but whatever.
M.forceMove(get_turf(src))
if (M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE
qdel(src)
else
to_chat(user, "<span class='warning'>[src] is too tightly bound to open without wirecutters!</span>")
return ..()
/obj/structure/strange_present/attack_hand(mob/user as mob)
to_chat(user, "<span class='warning'>[src] is too tightly bound to open without wirecutters!</span>")
return
///Loot crate///
/obj/item/weapon/winter_gift/dorkcube
name = "loot box"
desc = "Don't forget to shout the magic phrase when you open it! It smells faintly of iron."
icon = 'icons/obj/storage/storage.dmi'
icon_state = "lootbox_purple"
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/toolbox_ihl.dmi', "right_hand" = 'icons/mob/in-hand/right/toolbox_ihr.dmi')
item_state = "lootbox_purple"
/obj/item/weapon/winter_gift/dorkcube/attack_self(mob/user)
to_chat(user, "<span class='notice'>You begin ripping into the wrapper.</span>")
playsound(src, 'sound/items/poster_ripped.ogg', 100, 1)
if (do_after(user, src, 2 SECONDS))
var/turf/T = get_turf(user)
var/mob/living/carbon/human/blooddonor = new /mob/living/carbon/human
user.say("Loot get!")
playsound(src, 'sound/effects/splat.ogg', 30, 1)
for(var/atom/A in user.contents)
A.add_blood(blooddonor)
bloodmess_splatter(T, null, null, null, DEFAULT_BLOOD)
qdel(src)
var/obj/item/weapon/storage/toolbox/usedlootbox = new /obj/item/weapon/storage/toolbox
usedlootbox.add_blood(blooddonor)
user.put_in_hands(usedlootbox)
user.regenerate_icons()
qdel(blooddonor)