Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
2 changes: 2 additions & 0 deletions code/__DEFINES/zombie.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
#define ZOMBIE_THREATENED_CAP 125
///How much damage zombies take from razorwire
#define ZOMBIE_RAZORWIRE_DAMAGE 50
///The ratio of maximum allowed possessed sentient zombies to alive humans
#define ZOMBIE_SENTIENT_TO_HUMAN_RATIO 7
1 change: 1 addition & 0 deletions code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GLOBAL_LIST_INIT(simple_animals, list(list(),list(),list(),list())) // One for e
GLOBAL_LIST_EMPTY(living_cameras)
GLOBAL_LIST_EMPTY(aiEyes)
GLOBAL_LIST_EMPTY_TYPED(humans_by_zlevel, /list/mob/living/carbon/human) //z level /list/list of alive humans
GLOBAL_LIST_EMPTY(possessed_sentient_zombie_list)

GLOBAL_LIST_EMPTY(mob_config_movespeed_type_lookup)

Expand Down
3 changes: 3 additions & 0 deletions code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ GLOBAL_PROTECT(key_to_time_of_strain_swap)

///List of ssd living mobs
GLOBAL_LIST_EMPTY(ssd_living_mobs)

///Maximum allowed number of possessed sentient zombies
GLOBAL_VAR_INIT(maximum_allowed_possessed_zombies, 0)
7 changes: 7 additions & 0 deletions code/datums/actions/observer_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
if(new_mob.stat == DEAD)
to_chat(owner, span_warning("You cannot join if the mob is dead."))
return FALSE

if(iszombie(new_mob) && (length(GLOB.possessed_sentient_zombie_list) >= GLOB.maximum_allowed_possessed_zombies))
to_chat(owner, span_warning("There are too few marines. Possessing additional zombies is currently disabled."))
return FALSE

if(tgui_alert(owner, "Are you sure you want to take " + new_mob.real_name +" ("+new_mob.job.title+")?", "Take SSD mob", list("Yes", "No",)) != "Yes")
return

Expand Down Expand Up @@ -94,6 +99,8 @@

message_admins(span_adminnotice("[owner.key] took control of [new_mob.name] as [new_mob.p_they()] was ssd."))
log_admin("[owner.key] took control of [new_mob.name] as [new_mob.p_they()] was ssd.")
if(iszombie(new_mob))
GLOB.possessed_sentient_zombie_list += new_mob
var/mob/living/carbon/human/new_human = new_mob
var/datum/job/j = new_human.job
var/datum/outfit/job/o = j.outfit
Expand Down
3 changes: 3 additions & 0 deletions code/datums/gamemodes/zombie_crash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@
var/list/living_player_list = count_humans_and_zombies(count_flags = COUNT_IGNORE_HUMAN_SSD)
var/num_humans = living_player_list[1]
var/num_zombies = living_player_list[2]

GLOB.maximum_allowed_possessed_zombies = floor(num_humans / ZOMBIE_SENTIENT_TO_HUMAN_RATIO)

if(num_zombies * 0.125 >= num_humans) // if there's too much zombies, don't spawn even more
for(var/obj/effect/ai_node/spawner/zombie/spawner AS in GLOB.zombie_spawners)
if(!spawner.threat_warning)
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
. = ..()
if(!. || can_reenter_corpse)
return
GLOB.possessed_sentient_zombie_list -= src
var/mob/ghost = .
GLOB.key_to_time_of_death[ghost.key] = world.time
if(!aghosting && job?.job_flags & (JOB_FLAG_LATEJOINABLE|JOB_FLAG_ROUNDSTARTJOINABLE))//Only some jobs cost you your respawn timer.
Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/living/carbon/human/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@
/datum/species/proc/handle_death(mob/living/carbon/human/H)
return

///Handles any species-specific gib events
/datum/species/proc/handle_gib(mob/living/carbon/human/H)
return

///Handles any species-specific dusting events
/datum/species/proc/handle_dust(mob/living/carbon/human/H)
return

///Called in revival procs, useful for special species behaviour like zombie revival
/datum/species/proc/can_revive_to_crit(mob/living/carbon/human/H)
if(H.has_working_organs())
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
if(prob(100 - E.get_damage()))
// Override the current limb status
E.droplimb(gibbing = TRUE, silent = TRUE)
species.handle_gib(src)
return ..()

/mob/living/carbon/human/gib_animation()
Expand All @@ -27,6 +28,9 @@
hgibs(loc)
new /obj/effect/temp_visual/gib_particles(get_turf(src), get_blood_color())

/mob/living/carbon/human/dust()
species.handle_dust(src)
. = ..()


/mob/living/carbon/human/spawn_dust_remains()
Expand Down
9 changes: 9 additions & 0 deletions code/modules/mob/living/carbon/human/species_types/zombies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
return
addtimer(CALLBACK(H, TYPE_PROC_REF(/mob/living/carbon/human, revive_to_crit), TRUE, FALSE), revive_time)

/datum/species/zombie/handle_gib(mob/living/carbon/human/H)
. = ..()
GLOB.possessed_sentient_zombie_list -= H

/datum/species/zombie/handle_dust(mob/living/carbon/human/H)
. = ..()
GLOB.possessed_sentient_zombie_list -= H

/datum/species/zombie/can_revive_to_crit(mob/living/carbon/human/human)
if(human.on_fire || !human.has_working_organs() || isspaceturf(get_turf(human)))
SSmobs.stop_processing(human)
Expand All @@ -133,6 +141,7 @@
/// We start fading out the human and qdel them in set time
/datum/species/zombie/proc/fade_out_and_qdel_in(mob/living/carbon/human/H, time = 5 SECONDS)
GLOB.round_statistics.zombies_permad++
GLOB.possessed_sentient_zombie_list -= H
fade_out(H)
QDEL_IN(H, time)

Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,10 @@ below 100 is not dizzy
to_chat(M, span_warning("You are jobbanned from that role."))
return FALSE

if(iszombie(src) && (length(GLOB.possessed_sentient_zombie_list) >= GLOB.maximum_allowed_possessed_zombies))
to_chat(M, span_warning("There are too few marines. Possessing additional zombies is currently disabled."))
return FALSE

log_game("[key_name(M)] has taken over [key_name_admin(src)].")
message_admins("[key_name_admin(M)] has taken over [ADMIN_TPMONTY(src)].")

Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/living_health_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@
if(!iszombie(src))
set_species("Strong zombie")
AddComponent(/datum/component/ai_controller, /datum/ai_behavior/xeno/zombie/patrolling)
if(client && !(src in GLOB.possessed_sentient_zombie_list))
GLOB.possessed_sentient_zombie_list += src
heal_limbs(-health)
set_stat(CONSCIOUS)
overlay_fullscreen_timer(0.5 SECONDS, 10, "roundstart1", /atom/movable/screen/fullscreen/black)
Expand Down
Loading