Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Icewalkers and ghosts can now tell who joined and who left the Icemoon Dweller hole #2136

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion modular_nova/modules/primitive_catgirls/code/spawner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
uses = 12
deletes_on_zero_uses_left = FALSE

/// The list of real names of those that have gone back into the hole.
/// Should get modified automatically by `create()` and `put_back_in()`.
var/list/went_back_to_sleep = list()
/// The cached string to display for additional info on who joined and who left.
/// Nulled every time someone joins or leaves to ensure it gets re-generated.
var/join_and_leave_log_cache = null
/// The minimum time someone needs to be SSD before they can be put back in
var/ssd_time = 30 MINUTES

Expand All @@ -39,23 +45,77 @@
team = null
return ..()

/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/examine()
/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/examine(mob/user)
. = ..()

if(uses)
. += span_notice("You can see <b>[uses]</b> figures sound asleep down there.")
else
. += span_notice("It looks pretty empty.")

if(isprimitivedemihuman(user) || isobserver(user))
. += span_notice("<i>You could examine it more thoroughly...</i>")

return .


/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/examine_more(mob/user)
. = ..()

if(!isprimitivedemihuman(user) && !isobserver(user))
return

. += get_joined_and_left_log()


/**
* Returns the `join_and_leave_log_cache` string if it already exists, otherwise
* generates and returns it.
*/
/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/proc/get_joined_and_left_log()
if(join_and_leave_log_cache)
return join_and_leave_log_cache

var/list/joined_player_names = list()

for(var/datum/mind/joined_mind in team.members)
joined_player_names += joined_mind.name

if(!length(joined_player_names) && !length(went_back_to_sleep))
join_and_leave_log_cache = span_notice("Everyone still seems to be sleeping peacefully in the hole.")
return join_and_leave_log_cache

var/nobody_joined = !length(joined_player_names)
var/nobody_returned = !length(went_back_to_sleep)
var/should_add_newline = !nobody_returned && !nobody_joined // if we have both missing kin and kin who went back to sleep, add a newline

join_and_leave_log_cache = span_notice( \
"[nobody_joined ? "" : "You smell that the following kin are missing from the hole:\n\
<b>[joined_player_names.Join("</b>, <b>")]</b>"]\
[should_add_newline ? "\n\n" : ""]\
[nobody_returned ? "" : "You catch the scent of the following kin having recently went back to sleep:\n\
<b>[went_back_to_sleep.Join("</b>, <b>")]</b>"]" \
)

return join_and_leave_log_cache


/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/allow_spawn(mob/user, silent = FALSE)
if(!(user.key in team.players_spawned)) // One spawn per person
return TRUE
if(!silent)
to_chat(user, span_warning("It'd be weird if there were multiple of you in that cave, wouldn't it?"))
return FALSE


/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/create(mob/mob_possessor, newname)
. = ..()

// We remove their name from there if they come back.
went_back_to_sleep -= newname
join_and_leave_log_cache = null


// This stuff is put on equip because it turns out /special sometimes just don't get called because Nova
/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/equip(mob/living/carbon/human/spawned_human)
. = ..()
Expand Down Expand Up @@ -153,6 +213,8 @@
// or whatever.
team.players_spawned -= (target.key)
team.remove_member(target.mind)
went_back_to_sleep += target.real_name
join_and_leave_log_cache = null

for(var/list/record in GLOB.ghost_records)
if(record["name"] == target.real_name)
Expand Down
Loading