Files
Bubberstation/code/game/objects/structures/pinatas.dm
SkyratBot a98484d624 [MIRROR] Adds Pinatas that can be purchased by cargo and clown operatives! [MDB IGNORE] (#19829)
* Adds Pinatas that can be purchased by cargo and clown operatives! (#73868)

## About The Pull Request

Pinata's drop various items when struck with a sufficiently powerful
weapon. This PR adds two types, a standard one which can be bought from
cargo which contains various candy items and a syndicate one which
contains both candy items and explosives purchasable by clown
operatives.

The pinata functionality is also a component so admins can turn any
structure/machine/mob into a pinata and customize the "candy" inside

Sprites by @ Mey-Ha-Zah animated versions by me
## Why It's Good For The Game

Adds a cute little celebration themed structure that can be bought by
players to accommodate a celebration based gimmicks or the party trait.
I think the options on things to do as a crew during a celebration are a
bit limited at present with most of the options being making/purchasing
food, activity wise the main example of a celebration item is pin the
tail on the corgi which is a bit uninteresting, the pinata on the other
hand is more cathartic and provides a "reward" in the form of various
candy items for people who participate in smashing it. I also think its
just funny to have clown operative gambling half their TC to try and get
explosives.
## Changelog
🆑 Mey-Ha-Zah & NamelessFairy
add: Added pinata crates to cargo, they contain various candy items. Fun
at parties.
add: Clown operatives can now purchase a weapons grade pinata, this
contains both candy and explosives. Still fun at parties.
admin: Admins can now turn players, mobs and objects into pinata's with
the new pinata component.
/🆑

* Adds Pinatas that can be purchased by cargo and clown operatives!

---------

Co-authored-by: NamelessFairy <40036527+NamelessFairy@users.noreply.github.com>
2023-03-13 16:20:54 -07:00

93 lines
3.4 KiB
Plaintext

///A pinata that has a chance to drop candy items when struck with a melee weapon that deals at least 10 damage
/obj/structure/pinata
name = "corgi pinata"
desc = "A papier-mâché representation of a corgi that contains all sorts of sugary treats."
icon = 'icons/obj/toys/toy.dmi'
icon_state = "pinata_placed"
base_icon_state = "pinata_placed"
max_integrity = 300 //20 hits from a baseball bat
anchored = TRUE
///What sort of candy the pinata will contain
var/candy_options = list(
/obj/item/food/bubblegum,
/obj/item/food/candy,
/obj/item/food/chocolatebar,
/obj/item/food/gumball,
/obj/item/food/lollipop/cyborg,
)
///How much candy is dropped when the pinata is destroyed
var/destruction_loot = 5
///Debris dropped when the pinata is destroyed
var/debris = /obj/effect/decal/cleanable/wrapping/pinata
/obj/structure/pinata/Initialize(mapload)
. = ..()
AddComponent(/datum/component/pinata, candy = candy_options, death_drop = destruction_loot)
/obj/structure/pinata/take_damage(damage_amount, damage_type, damage_flag, sound_effect, attack_dir, armour_penetration)
. = ..()
if(get_integrity() < (max_integrity/2))
icon_state = "[base_icon_state]_damaged"
if(damage_amount >= 10) // Swing means minimum damage threshhold for dropping candy is met.
flick("[icon_state]_swing", src)
/obj/structure/pinata/play_attack_sound(damage_amount, damage_type, damage_flag)
switch(damage_type)
if(BRUTE)
if(damage_amount)
playsound(src, 'sound/weapons/slash.ogg', 50, TRUE)
else
playsound(src, 'sound/weapons/tap.ogg', 50, TRUE)
if(BURN)
playsound(src, 'sound/items/welder.ogg', 100, TRUE)
/obj/structure/pinata/deconstruct(disassembled)
new debris(get_turf(src))
return ..()
///An item that when used inhand spawns an immovable pinata
/obj/item/pinata
name = "pinata assembly kit"
desc = "A papier-mâché corgi that contains various candy, must be set up before you can smash it."
icon = 'icons/obj/toys/toy.dmi'
icon_state = "pinata"
///The pinata that is created when this is placed.
var/pinata_type = /obj/structure/pinata
/obj/item/pinata/attack_self(mob/user)
var/turf/player_turf = get_turf(user)
if(player_turf?.is_blocked_turf(TRUE))
return FALSE
balloon_alert_to_viewers("setting up pinata...")
if(!do_after(user, 4 SECONDS, target = get_turf(user), progress = TRUE))
balloon_alert(user, "cancelled!")
new pinata_type(get_turf(user))
balloon_alert(user, "pinata setup")
qdel(src)
/obj/structure/pinata/syndie
name = "syndicate corgi pinata"
desc = "A papier-mâché representation of a corgi that contains all sorts of bombastic treats."
icon_state = "pinata_syndie_placed"
base_icon_state = "pinata_syndie_placed"
destruction_loot = 2
debris = /obj/effect/decal/cleanable/wrapping/pinata/syndie
candy_options = list(
/obj/item/food/bubblegum,
/obj/item/food/candy,
/obj/item/food/chocolatebar,
/obj/item/food/gumball,
/obj/item/food/lollipop,
/obj/item/grenade/c4,
/obj/item/grenade/clusterbuster/soap,
/obj/item/grenade/empgrenade,
/obj/item/grenade/frag,
/obj/item/grenade/syndieminibomb,
) //Candy items at the top, explosives at the bottom to be easier to read instead of fully alphabetized.
/obj/item/pinata/syndie
name = "weapons grade pinata assembly kit"
desc = "A papier-mâché corgi that contains various candy and explosives, must be set up before you can smash it."
icon_state = "pinata_syndie"
pinata_type = /obj/structure/pinata/syndie