Files
Bubberstation/code/modules/bitrunning/components/bitrunning_points.dm
Jeremiah a6b194c51c Removes virtual-specific subtypes of drinking glass + adds a new fishing map (#79423)
## About The Pull Request
Changed how loot signals work with bitrunning entirely, which allows map
creators to attach functionality to objects without creating subtypes of
the item

As a bonus I added a fishing minigame map which uses it
## Why It's Good For The Game
It's a messy solution to need to create subtypes just for the one-off
map that needs them
## Changelog
🆑
add: Added a new fishing map to bitrunning.
add: You are no longer limited to pina coladas on the beach bar domain.
Cheers!
/🆑
2023-11-03 02:19:26 +00:00

38 lines
1.1 KiB
Plaintext

/// Attaches to a turf so it spawns a crate when a certain amount of points are added to it.
/datum/component/bitrunning_points
/// The amount required to spawn a crate
var/points_goal = 10
/// A special condition limits this from spawning a crate
var/points_received = 0
/datum/component/bitrunning_points/Initialize(datum/lazy_template/virtual_domain/domain)
. = ..()
if(!isturf(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(domain, COMSIG_BITRUNNER_GOAL_POINT, PROC_REF(on_add_points))
/// Listens for points to be added which will eventually spawn a crate.
/datum/component/bitrunning_points/proc/on_add_points(datum/source, points_to_add)
SIGNAL_HANDLER
points_received += points_to_add
if(points_received < points_goal)
return
reveal()
/// Spawns the crate with some effects
/datum/component/bitrunning_points/proc/reveal()
playsound(src, 'sound/magic/blink.ogg', 50, TRUE)
var/turf/tile = parent
new /obj/structure/closet/crate/secure/bitrunning/encrypted(tile)
var/datum/effect_system/spark_spread/quantum/sparks = new(tile)
sparks.set_up(number = 5, location = tile)
sparks.start()
qdel(src)