Skip to content

Commit

Permalink
Back Down You Go! | Allows Icewalkers to cryo by returning into their…
Browse files Browse the repository at this point in the history
… hole (#932)

* Starts working on letting icewalkers cryo

* A bit more progress (still WIP)

* Now it should be mostly complete, just needs tested later

* Fixes a few more things so it works better

* Makes it work properly on other people as well, implements item drop blacklist for items they spawn with

* This bothered me

* Updates to address reviews

* Update modular_nova/modules/primitive_catgirls/code/spawner.dm

---------

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
  • Loading branch information
2 people authored and StealsThePRs committed Feb 17, 2024
1 parent 00e81ff commit fa86052
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/__HELPERS/~nova_helpers/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define ishemophage(A) (is_species(A, /datum/species/hemophage))
#define issnail(A) (is_species(A, /datum/species/snail))
#define isluminescent(A) (is_species(A, /datum/species/jelly/luminescent))
#define isprimitivedemihuman(A) (is_species(A, /datum/species/human/felinid/primitive))
//Antags
#define ishorrorling(A) (istype(A, /mob/living/simple_animal/hostile/true_changeling))
#define iscorticalborer(A) (istype(A, /mob/living/basic/cortical_borer))
Expand Down
129 changes: 128 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,10 @@
uses = 12
deletes_on_zero_uses_left = FALSE

/// The minimum time someone needs to be SSD before they can be put back in
var/ssd_time = 30 MINUTES


/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/Initialize(mapload)
. = ..()
team = new /datum/team/primitive_catgirls()
Expand Down Expand Up @@ -52,14 +56,137 @@
to_chat(user, span_warning("It'd be weird if there were multiple of you in that cave, wouldn't it?"))
return FALSE

// This stuff is put on equip because it turns out /special sometimes just don't get called because skyrat
// 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)
. = ..()

spawned_human.mind.add_antag_datum(/datum/antagonist/primitive_catgirl, team)

team.players_spawned += (spawned_human.key)


/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/MouseDrop_T(mob/living/carbon/human/target, mob/living/user)
if(!isprimitivedemihuman(target) || !can_interact(user) || !target.Adjacent(user) || target.buckled)
return

if(target.stat == DEAD)
to_chat(user, span_danger("Dead kin cannot be put back to sleep."))
return

if(target.key && target != user)
if(!target.get_organ_by_type(/obj/item/organ/internal/brain) || (target.mind && !target.ssd_indicator))
to_chat(user, span_danger("Awake kin cannot be put back to sleep against their will."))
return

if(target.lastclienttime + ssd_time >= world.time)
to_chat(user, span_userdanger("You can't put [target] into [src] for another <b>[round(((ssd_time - (world.time - target.lastclienttime)) / (1 MINUTES)), 1)]</b> minutes."))
log_admin("[key_name(user)] has attempted to put [key_name(target)] back into [src], but they were only disconnected for [round(((world.time - target.lastclienttime) / (1 MINUTES)), 1)] minutes.")
message_admins("[key_name(user)] has attempted to put [key_name(target)] back into [src]. [ADMIN_JMP(src)]")
return

else if(tgui_alert(user, "Would you like to place [target] into [src]?", "Put back to sleep?", list("Yes", "No")) == "Yes")

visible_message(span_infoplain("[user] starts putting [target] into [src]..."))

if(!do_after(user, 3 SECONDS, target))
balloon_alert("cancelled transfer!")
return

to_chat(user, span_danger("You put [target] into [src]."))
log_admin("[key_name(user)] has put [key_name(target)] back into [src].")
message_admins("[key_name(user)] has put [key_name(target)] back into [src]. [ADMIN_JMP(src)]")

if(target == user)
if(tgui_alert(target, "Would you like to go back to sleep?", "Go back to sleep?", list("Yes", "No")) != "Yes")
return

visible_message(span_infoplain("[user] starts climbing down into [src]..."))

if(!do_after(user, 3 SECONDS, target))
balloon_alert("cancelled transfer!")
return

if(LAZYLEN(target.buckled_mobs) > 0)
if(target == user)
to_chat(user, span_danger("You can't fit into [src] while someone is buckled to you."))
else
to_chat(user, span_danger("You can't fit [target] into [src] while someone is buckled to them."))

return

// Just in case something happened in-between, to make sure it doesn't do unexpected behaviors.
if(!isprimitivedemihuman(target) || !can_interact(user) || !target.Adjacent(user) || target.buckled || target.stat == DEAD)
return

if(target == user)
visible_message(span_infoplain("[user] climbs down into [src]."))
else
visible_message(span_infoplain("[user] puts [target] into [src]."))

log_admin("[key_name(target)] returned to [src].")
message_admins("[key_name_admin(target)] returned to [src]. [ADMIN_JMP(src)]")
add_fingerprint(target)
put_back_in(target)


/**
* Puts the target back into the spawner, effectively qdel'ing them after
* stripping them of all their items, and finishes by adding back a use to the
* spawner.
*/
/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/proc/put_back_in(mob/living/carbon/human/target)
if(!istype(target))
return

// We don't want to constantly drop stuff that they spawn with.
var/static/list/item_drop_blacklist
if(!item_drop_blacklist)
item_drop_blacklist = generate_item_drop_blacklist()

for(var/obj/item/item in target)
if(item_drop_blacklist[item.type] || (item.item_flags & ABSTRACT) || HAS_TRAIT(item, TRAIT_NODROP))
continue

target.dropItemToGround(item, FALSE)

// We make sure people can come back in again, if they needed to fix prefs
// or whatever.
team.players_spawned -= (target.key)
team.remove_member(target.mind)

for(var/list/record in GLOB.ghost_records)
if(record["name"] == target.real_name)
GLOB.ghost_records.Remove(list(record))
break

// Just so the target's ghost ends up above the hole.
target.forceMove(loc)
target.ghostize(FALSE)

qdel(target)

uses += 1


/**
* Simple helper to generate the item drop blacklist based on the spawner's
* outfit, only taking the used slots into account.
*/
/obj/effect/mob_spawn/ghost_role/human/primitive_catgirl/proc/generate_item_drop_blacklist()
PROTECTED_PROC(TRUE)

var/list/blacklist = list()

blacklist[initial(outfit.uniform)] = TRUE
blacklist[initial(outfit.shoes)] = TRUE
blacklist[initial(outfit.gloves)] = TRUE
blacklist[initial(outfit.suit)] = TRUE
blacklist[initial(outfit.neck)] = TRUE
blacklist[initial(outfit.back)] = TRUE

return blacklist


/datum/job/primitive_catgirl
title = "Icemoon Dweller"

Expand Down

0 comments on commit fa86052

Please sign in to comment.