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

extermination #101

Merged
merged 7 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define COMSIG_GLOB_NUKE_EXPLODED "!nuke_exploded"
#define COMSIG_GLOB_NUKE_DIFFUSED "!nuke_diffused"
#define COMSIG_GLOB_DISK_GENERATED "!disk_produced"
#define COMSIG_GLOB_DISK_PROGRESS "!disk_progress"

#define COMSIG_GLOB_SHIP_SELF_DESTRUCT_ACTIVATED "!ship_self_destruct_activated"

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
#define iscombatpatrolgamemode(O) (istype(O, /datum/game_mode/hvh/combat_patrol))
#define issensorcapturegamemode(O) (istype(O, /datum/game_mode/hvh/combat_patrol/sensor_capture))
#define iscampaigngamemode(O) (istype(O, /datum/game_mode/hvh/campaign))
#define isexterminationgamemode(O) (istype(O, /datum/game_mode/infestation/distress/extermination))
#define isdistressgamemode(O) (istype(O, /datum/game_mode/infestation/distress))

#define isxenoresearcharea(A) (istype(A, /area/mainship/medical/medical_science))
Expand Down
116 changes: 116 additions & 0 deletions code/datums/gamemodes/extermination.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/datum/game_mode/infestation/distress/extermination
name = "Extermination"
config_tag = "Extermination"

silo_scaling = 0 //ha ha

flags_round_type = MODE_INFESTATION|MODE_LATE_OPENING_SHUTTER_TIMER|MODE_XENO_RULER|MODE_PSY_POINTS|MODE_PSY_POINTS_ADVANCED|MODE_DEAD_GRAB_FORBIDDEN|MODE_HIJACK_POSSIBLE|MODE_SILO_RESPAWN|MODE_SILOS_SPAWN_MINIONS|MODE_ALLOW_XENO_QUICKBUILD

///How long between two larva check, 2 minutes for crush
var/larva_check_interval = 4 MINUTES
///Last time larva balance was checked
var/last_larva_check
///Multiplier for xenos, increases over time
var/xeno_factor = 1
///How much xeno_factor you get for progress on discs
var/xeno_factor_per_progress_on_disk = 0.1

/datum/game_mode/infestation/distress/extermination/post_setup()
. = ..()
for(var/i in GLOB.nuke_spawn_locs)
new /obj/machinery/nuclearbomb(i)
generate_nuke_disk_spawners()
RegisterSignal(SSdcs, COMSIG_GLOB_DISK_PROGRESS, PROC_REF(increase_xeno_factor))
RegisterSignal(SSdcs, COMSIG_GLOB_NUKE_EXPLODED, PROC_REF(on_nuclear_explosion))
RegisterSignal(SSdcs, COMSIG_GLOB_NUKE_DIFFUSED, PROC_REF(on_nuclear_diffuse))
RegisterSignal(SSdcs, COMSIG_GLOB_NUKE_START, PROC_REF(on_nuke_started))

///Receive notifications about disks generation progress
/datum/game_mode/infestation/distress/extermination/proc/increase_xeno_factor(datum/source, obj/machinery/computer/nuke_disk_generator/generatingcomputer)
SIGNAL_HANDLER
xeno_factor += xeno_factor_per_progress_on_disk
SSpoints.supply_points[FACTION_TERRAGOV] += 1000

/datum/game_mode/infestation/distress/extermination/check_finished()
if(round_finished)
return TRUE

if(world.time < (SSticker.round_start_time + 5 SECONDS))
return FALSE

var/list/living_player_list = count_humans_and_xenos(count_flags = COUNT_IGNORE_ALIVE_SSD|COUNT_IGNORE_XENO_SPECIAL_AREA)
var/num_humans = living_player_list[1]
var/num_xenos = living_player_list[2]
var/num_humans_ship = living_player_list[3]

if(SSevacuation.dest_status == NUKE_EXPLOSION_FINISHED)
message_admins("Round finished: [MODE_GENERIC_DRAW_NUKE]") //ship blows, no one wins
round_finished = MODE_GENERIC_DRAW_NUKE
return TRUE

if(round_stage == INFESTATION_DROPSHIP_CAPTURED_XENOS)
message_admins("Round finished: [MODE_INFESTATION_X_MINOR]")
round_finished = MODE_INFESTATION_X_MINOR
return TRUE

if(planet_nuked == INFESTATION_NUKE_COMPLETED)
message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines managed to nuke the colony
round_finished = MODE_INFESTATION_M_MAJOR
return TRUE

if(!num_humans)
if(!num_xenos)
message_admins("Round finished: [MODE_INFESTATION_DRAW_DEATH]") //everyone died at the same time, no one wins
round_finished = MODE_INFESTATION_DRAW_DEATH
return TRUE
message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped out ALL the marines without hijacking, xeno major victory
round_finished = MODE_INFESTATION_X_MAJOR
return TRUE
if(!num_xenos)
if(round_stage == INFESTATION_MARINE_CRASHING)
message_admins("Round finished: [MODE_INFESTATION_M_MINOR]") //marines lost the ground operation but managed to wipe out Xenos on the ship at a greater cost, minor victory
round_finished = MODE_INFESTATION_M_MINOR
return TRUE
message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines win big
round_finished = MODE_INFESTATION_M_MAJOR
return TRUE
if(round_stage == INFESTATION_MARINE_CRASHING && !num_humans_ship)
if(SSevacuation.human_escaped > SSevacuation.initial_human_on_ship * 0.5)
message_admins("Round finished: [MODE_INFESTATION_X_MINOR]") //xenos have control of the ship, but most marines managed to flee
round_finished = MODE_INFESTATION_X_MINOR
return
message_admins("Round finished: [MODE_INFESTATION_X_MAJOR]") //xenos wiped our marines, xeno major victory
round_finished = MODE_INFESTATION_X_MAJOR
return TRUE
return FALSE

/datum/game_mode/infestation/distress/extermination/process()
. = ..()

if(world.time > last_larva_check + larva_check_interval)
balance_scales()
last_larva_check = world.time

/datum/game_mode/infestation/distress/extermination/proc/balance_scales()
var/datum/hive_status/normal/xeno_hive = GLOB.hive_datums[XENO_HIVE_NORMAL]
var/datum/job/xeno_job = SSjob.GetJobType(/datum/job/xenomorph)
var/active_xenos = xeno_job.total_positions - xeno_job.current_positions //burrowed
for(var/mob/living/carbon/xenomorph/xeno AS in GLOB.alive_xeno_list_hive[XENO_HIVE_NORMAL])
if(xeno.xeno_caste.caste_flags & CASTE_IS_A_MINION)
continue
active_xenos++
var/estimated_joblarvaworth = get_total_joblarvaworth() * xeno_factor
var/larva_surplus = (estimated_joblarvaworth - (active_xenos * xeno_job.job_points_needed )) / xeno_job.job_points_needed
var/real_larva_surplus
if(!active_xenos)
real_larva_surplus = max(1, round(larva_surplus, 1))
xeno_job.add_job_positions(real_larva_surplus)
GLOB.round_statistics.larva_from_silo += real_larva_surplus
xeno_hive.update_tier_limits()
return
if(larva_surplus < 1)
return //Things are balanced, no burrowed needed
real_larva_surplus = round(larva_surplus, 1)
xeno_job.add_job_positions(real_larva_surplus)
GLOB.round_statistics.larva_from_silo += real_larva_surplus
xeno_hive.update_tier_limits()
27 changes: 23 additions & 4 deletions code/game/objects/machinery/computer/nuke_disk_generator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
GLOB.nuke_disk_generators -= src
return ..()


/obj/machinery/computer/nuke_disk_generator/process()
. = ..()
if(. || !current_timer)
Expand All @@ -83,18 +82,37 @@
update_minimap_icon()
visible_message("<b>[src]</b> shuts down as it loses power. Any running programs will now exit")


/obj/machinery/computer/nuke_disk_generator/attackby(obj/item/I, mob/living/user, params)
return attack_hand(user)

/obj/machinery/computer/nuke_disk_generator/attack_alien(mob/living/carbon/xenomorph/xeno_attacker, damage_amount = xeno_attacker.xeno_caste.melee_damage, damage_type = BRUTE, damage_flag = MELEE, effects = TRUE, armor_penetration = 0, isrightclick = FALSE)
if(xeno_attacker.status_flags & INCORPOREAL) //Incorporeal xenos cannot attack physically.
return
if(!(busy || current_timer))
return

if(xeno_attacker.do_actions)
return balloon_alert(xeno_attacker, "busy")
if(!do_after(xeno_attacker, 2 SECONDS, NONE, src, BUSY_ICON_DANGER, BUSY_ICON_HOSTILE))
return
xeno_attacker.do_attack_animation(src, ATTACK_EFFECT_CLAW)
xeno_attacker.visible_message(span_danger("[xeno_attacker] slashes \the [src]!"), \
span_danger("We slash \the [src]!"), null, 5)
playsound(loc, "alien_claw_metal", 25, TRUE)

seconds_elapsed = (segment_time/10) * completed_segments
running = FALSE
deltimer(current_timer)
current_timer = null
update_minimap_icon()
visible_message("<b>[src]</b> shuts down. Any running programs will now exit")

/obj/machinery/computer/nuke_disk_generator/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "NukeDiskGenerator")
ui.open()


/obj/machinery/computer/nuke_disk_generator/ui_data(mob/user)
var/list/data = list()

Expand Down Expand Up @@ -127,7 +145,6 @@

return data


/obj/machinery/computer/nuke_disk_generator/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
Expand Down Expand Up @@ -180,6 +197,8 @@
visible_message(span_notice("[src] beeps as it ready to print."))
return

SEND_GLOBAL_SIGNAL(COMSIG_GLOB_DISK_PROGRESS, src)

visible_message(span_notice("[src] beeps as it's program requires attention."))

///Change minimap icon if its on or off
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/hive_upgrades.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ GLOBAL_LIST_INIT(tier_to_primo_upgrade, list(
to_chat(buyer, span_xenowarning("Another silo is too close!"))
return FALSE

if(isexterminationgamemode(SSticker.mode) && length(GLOB.xeno_resin_silos_by_hive[buyer.hivenumber]) >= 1)
homexp13 marked this conversation as resolved.
Show resolved Hide resolved
if(!silent)
to_chat(buyer, span_xenowarning("Hive cannot support more than 1 active silos!"))
return FALSE

if(length(GLOB.xeno_resin_silos_by_hive[buyer.hivenumber]) >= 2)
if(!silent)
to_chat(buyer, span_xenowarning("Hive cannot support more than 2 active silos!"))
Expand Down
2 changes: 2 additions & 0 deletions code/modules/xenomorph/silo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
COOLDOWN_DECLARE(silo_proxy_alert_cooldown)

/obj/structure/xeno/silo/Initialize(mapload, _hivenumber)
if(isexterminationgamemode(SSticker.mode))
xeno_structure_flags &= ~CRITICAL_STRUCTURE
homexp13 marked this conversation as resolved.
Show resolved Hide resolved
. = ..()
center_turf = get_step(src, NORTHEAST)
if(!istype(center_turf))
Expand Down
1 change: 1 addition & 0 deletions tgmc.dme
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@
#include "code\datums\gamemodes\crash.dm"
#include "code\datums\gamemodes\distress.dm"
#include "code\datums\gamemodes\extended.dm"
#include "code\datums\gamemodes\extermination.dm"
#include "code\datums\gamemodes\hvh.dm"
#include "code\datums\gamemodes\infestation.dm"
#include "code\datums\gamemodes\nuclear_war.dm"
Expand Down
Loading