[MIRROR] Refactors the Nuclear Authentication Disk's Lone Op Behavior Into a Component, + Examine Message [MDB IGNORE] (#19407)

* Refactors the Nuclear Authentication Disk's Lone Op Behavior Into a Component, + Examine Message (#73453)

## About The Pull Request

### Refactor

Turns all the behavior for the nuke disk raising lone op probability
when unsecured into a new component, the "Keep Me Secure" component. As
an example (and really, I made it to test that the component was
actually working), there is a new admin plush called the "whiny plushie"
that will change icon depending on whether it is secure or not. Useful!

### Examine

I also added an examine message. Will explain below

## Why It's Good For The Game

The examine message was really what this entire pr's purpose was really
for.

>
[Capsandi](https://tgstation13.org/phpBB/memberlist.php?mode=viewprofile&u=7767)
wrote:
[↑](https://tgstation13.org/phpBB/viewtopic.php?p=665827#p665827)Wed Feb
15, 2023 2:42 pm
Someone needs to pr some sort of indicator as to whether the disk is
'secure' or not so players who don't know about the niche lone op
mechanic won't make the same intuitive assumption (though swat has been
trolled for putting it in the safe before).

I agree with this for the same reasons I did #73016 so I'll restate the
point with it here: A piece of banning a captain recently was that they
didn't secure the disk, but there is no indication in game that the disk
has special condiitons that trigger lone op, just that it should be kept
safe (which yeah, nuke ops want it). I'd rather remove the ambiguity of
a captain knowing this mechanic or not for the sake of the game, a
single examine for it is harmless

I'm considering this administration, not a feature. If maints want me to
take it out and have this be refactor only, that's fine with me

## Changelog
🆑
refactor: Refactors how nuclear activation disk works. Shouldn't notice
a whole lot but if you do, it might be because of this.
admin: Disk now has an examine message for whether it's secure or not,
to make it less ambiguous for players.
/🆑

* Refactors the Nuclear Authentication Disk's Lone Op Behavior Into a Component, + Examine Message

---------

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-02 22:06:22 -08:00
committed by GitHub
co-authored by tralezab
parent 8946091ddb
commit f9f4c80055
5 changed files with 148 additions and 46 deletions
@@ -18,10 +18,6 @@
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
/// Whether we're a real nuke disk or not.
var/fake = FALSE
/// The last secure location the disk was at.
var/turf/last_secured_location
/// The last world time the disk moved.
var/last_disk_move
/datum/armor/disk_nuclear
bomb = 30
@@ -34,54 +30,37 @@
AddComponent(/datum/component/stationloving, !fake)
if(!fake)
AddComponent(/datum/component/keep_me_secure, CALLBACK(src, PROC_REF(secured_process)), CALLBACK(src, PROC_REF(unsecured_process)))
SSpoints_of_interest.make_point_of_interest(src)
last_disk_move = world.time
START_PROCESSING(SSobj, src)
/obj/item/disk/nuclear/process()
if(fake)
STOP_PROCESSING(SSobj, src)
CRASH("A fake nuke disk tried to call process(). Who the fuck and how the fuck")
/obj/item/disk/nuclear/proc/secured_process(last_move)
var/turf/new_turf = get_turf(src)
var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control
if(istype(loneop) && loneop.occurrences < loneop.max_occurrences && prob(loneop.weight))
loneop.weight = max(loneop.weight - 1, 0)
if(loneop.weight % 5 == 0 && SSticker.totalPlayers > 1)
message_admins("[src] is secured (currently in [ADMIN_VERBOSEJMP(new_turf)]). The weight of Lone Operative is now [loneop.weight].")
log_game("[src] being secured has reduced the weight of the Lone Operative event to [loneop.weight].")
if (is_secured())
last_secured_location = new_turf
last_disk_move = world.time
/obj/item/disk/nuclear/proc/unsecured_process(last_move)
var/turf/new_turf = get_turf(src)
/// How comfy is our disk?
var/disk_comfort_level = 0
//Go through and check for items that make disk comfy
for(var/obj/comfort_item in loc)
if(istype(comfort_item, /obj/item/bedsheet) || istype(comfort_item, /obj/structure/bed))
disk_comfort_level++
if(last_move < world.time - 500 SECONDS && prob((world.time - 500 SECONDS - last_move)*0.0001))
var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control
if(istype(loneop) && loneop.occurrences < loneop.max_occurrences && prob(loneop.weight))
loneop.weight = max(loneop.weight - 1, 0)
if(istype(loneop) && loneop.occurrences < loneop.max_occurrences)
loneop.weight += 1
if(loneop.weight % 5 == 0 && SSticker.totalPlayers > 1)
message_admins("[src] is secured (currently in [ADMIN_VERBOSEJMP(new_turf)]). The weight of Lone Operative is now [loneop.weight].")
log_game("[src] being secured has reduced the weight of the Lone Operative event to [loneop.weight].")
else
/// How comfy is our disk?
var/disk_comfort_level = 0
//Go through and check for items that make disk comfy
for(var/obj/comfort_item in loc)
if(istype(comfort_item, /obj/item/bedsheet) || istype(comfort_item, /obj/structure/bed))
disk_comfort_level++
if(last_disk_move < world.time - 5000 && prob((world.time - 5000 - last_disk_move)*0.0001))
var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control
if(istype(loneop) && loneop.occurrences < loneop.max_occurrences)
loneop.weight += 1
if(loneop.weight % 5 == 0 && SSticker.totalPlayers > 1)
if(disk_comfort_level >= 2)
visible_message(span_notice("[src] sleeps soundly. Sleep tight, disky."))
message_admins("[src] is unsecured in [ADMIN_VERBOSEJMP(new_turf)]. The weight of Lone Operative is now [loneop.weight].")
log_game("[src] was left unsecured in [loc_name(new_turf)]. Weight of the Lone Operative event increased to [loneop.weight].")
/obj/item/disk/nuclear/proc/is_secured()
if (last_secured_location == get_turf(src))
return FALSE
var/mob/holder = pulledby || get(src, /mob)
if (isnull(holder?.client))
return FALSE
return TRUE
if(disk_comfort_level >= 2)
visible_message(span_notice("[src] sleeps soundly. Sleep tight, disky."))
message_admins("[src] is unsecured in [ADMIN_VERBOSEJMP(new_turf)]. The weight of Lone Operative is now [loneop.weight].")
log_game("[src] was left unsecured in [loc_name(new_turf)]. Weight of the Lone Operative event increased to [loneop.weight].")
/obj/item/disk/nuclear/examine(mob/user)
. = ..()