Files
Bubberstation/code/modules/bitrunning/components/bitrunning_points.dm
SkyratBot 964fc99589 [MIRROR] Feature: bitrunner, a new supply role (READY) [MDB IGNORE] (#23865)
* Feature: bitrunner, a new supply role (READY)

* Delete bepis.dm

* Conflicts

* Update dynamic_rulesets_midround.dm

* Fixing this invalid icon file path

It was trying to use the aesthetics one

* Bepis is dead

* New digi sprites courtesy of CandleJaxx!!

Now in the correct branch!

* Fixing merge conflict

* bitrunning hotfixes [NO GBP]

* Modular health adjustments

* Revert "Modular health adjustments"

This reverts commit 0ff3c48d398f6c1aac51cdf8fecaf869491bbc86.

* Modular health adjustments

Only this one should be necessary

* The screenshot test

* Bitrunner den for voidraptor (FOR #23865) (#23891)

* no shower in sight

* lets bitrunners actually get to their room and spawn there

* New digi sprites courtesy of CandleJaxx!!

* Revert "New digi sprites courtesy of CandleJaxx!!"

This reverts commit eea9f47de256dd407c78450bc8f2a09b814f93e9.

---------

Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>

* Removes bitrunning unit tests (#78607)

## About The Pull Request
Removes the fraction of unit tests I thought would be safe.
Not thrilled that I have to exclude ALL unit tests now, but hey.

The issue is that atmos attempts to process on a turf which hasn't
initialized yet.
## Why It's Good For The Game
Other PRs can pass checks now
## Changelog
N/A

* Update birdshot.dmm

* Tweaks the BEPIS category of the bitrunning order console

* Adds back the flashdark that we had skyrat edited in

* Update tgstation.dme

* Fixes Voidraptor bitrunning den not being connected to the powergrid

---------

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Paxilmaniac <82386923+Paxilmaniac@users.noreply.github.com>
Co-authored-by: Profakos <profakos@gmail.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
2023-09-29 20:53:36 -04:00

47 lines
1.6 KiB
Plaintext

/// Attaches a component which listens for a given signal from the item.
///
/// When the signal is received, it will add points to the signaler.
/datum/component/bitrunning_points
/// The range at which we can find the signaler
var/max_point_range
/// Weakref to the loot crate landmark - where we send points
var/datum/weakref/our_spawner
/// The amount of points per each signal
var/points_per_signal
/// The signal we listen for
var/signal_type
/datum/component/bitrunning_points/Initialize(signal_type, points_per_signal = 1, max_point_range = 4)
src.max_point_range = max_point_range
src.points_per_signal = points_per_signal
src.signal_type = signal_type
locate_spawner()
/datum/component/bitrunning_points/RegisterWithParent()
RegisterSignal(parent, signal_type, PROC_REF(on_event))
/datum/component/bitrunning_points/UnregisterFromParent()
UnregisterSignal(parent, signal_type)
/// Finds the signaler if it hasn't been found yet.
/datum/component/bitrunning_points/proc/locate_spawner()
var/obj/effect/landmark/bitrunning/loot_signal/spawner = our_spawner?.resolve()
if(spawner)
return spawner
for(var/obj/effect/landmark/bitrunning/loot_signal/found in GLOB.landmarks_list)
if(IN_GIVEN_RANGE(get_turf(parent), found, max_point_range))
our_spawner = WEAKREF(found)
return found
/// Once the specified signal is received, whisper to the spawner to add points.
/datum/component/bitrunning_points/proc/on_event(datum/source)
SIGNAL_HANDLER
var/obj/effect/landmark/bitrunning/loot_signal/spawner = locate_spawner()
if(isnull(spawner))
return
SEND_SIGNAL(spawner, COMSIG_BITRUNNER_GOAL_POINT, points_per_signal)