Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Points Defence [Semi-Modular] #112

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5a41f29
points_defence
homexp13 Nov 10, 2023
68974e0
Merge branch 'master' into points_defence
Blundir Nov 16, 2023
dea8e9d
Merge branch 'master' into points_defence
Blundir Nov 16, 2023
f865f41
tower_rutgmc
homexp13 Nov 24, 2023
1596cdd
todo_finish
homexp13 Nov 24, 2023
fc7fe62
DROPSHIP_IMMUNE
homexp13 Nov 24, 2023
e128b44
more req points
homexp13 Nov 24, 2023
4408e73
Merge branch 'master' into points_defence
homexp13 Nov 24, 2023
b1069e0
test_fix
homexp13 Nov 24, 2023
60a7642
list_cleaning
homexp13 Nov 24, 2023
41d15d9
fix_2
homexp13 Nov 29, 2023
43c6365
Merge branch 'master' into points_defence
homexp13 Nov 29, 2023
4402cfa
Merge branch 'rebase' into points_defence
homexp13 Feb 10, 2024
dfd93f3
fix?
homexp13 Feb 10, 2024
9f97bde
fix_2
homexp13 Feb 10, 2024
ffe9245
Merge branch 'rebase' into points_defence
homexp13 Mar 28, 2024
200335d
more sensors and larva
homexp13 Mar 28, 2024
8b5aa22
do after fix
homexp13 Mar 30, 2024
ded9597
point buff
homexp13 Mar 30, 2024
98d484c
nerf point
homexp13 Mar 31, 2024
8e5d398
larva scaling change
homexp13 Mar 31, 2024
824773c
a bit more silo scaling
homexp13 Mar 31, 2024
4ac682d
more cas points and less towers
homexp13 Mar 31, 2024
9b2cff6
walance
homexp13 Apr 5, 2024
1d4715a
bruh
homexp13 Apr 5, 2024
c658a74
leaders
homexp13 Apr 6, 2024
0dff2f6
online scaling
homexp13 Apr 12, 2024
0e1bec0
Merge branch 'rebase' of https://github.com/homexp13/TerraGov-Marine-…
homexp13 Apr 12, 2024
166baa6
leadeship
homexp13 Apr 12, 2024
2b8bcb4
alerts
homexp13 Apr 12, 2024
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
8 changes: 8 additions & 0 deletions code/datums/gamemodes/_game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ GLOBAL_LIST_INIT(bioscan_locations, list(
parts += "[GLOB.round_statistics.larva_from_psydrain] larvas came from psydrain."
if(GLOB.round_statistics.larva_from_silo)
parts += "[GLOB.round_statistics.larva_from_silo] larvas came from silos."
//RUTGMC EDIT ADDITION BEGIN - Points defence
if(GLOB.round_statistics.larva_from_towers)
parts += "[GLOB.round_statistics.larva_from_towers] larvas came from infestation towers."
//RUTGMC EDIT ADDITION END
if(GLOB.round_statistics.larva_from_cocoon)
parts += "[GLOB.round_statistics.larva_from_cocoon] larvas came from cocoons."
if(GLOB.round_statistics.larva_from_marine_spawning)
Expand All @@ -466,6 +470,10 @@ GLOBAL_LIST_INIT(bioscan_locations, list(
parts += "[GLOB.round_statistics.psy_shield_blasts] number of times Warlocks detonated a Psychic Shield."
if(GLOB.round_statistics.points_from_mining)
parts += "[GLOB.round_statistics.points_from_mining] requisitions points gained from mining."
//RUTGMC EDIT ADDITION BEGIN - Points defence
if(GLOB.round_statistics.points_from_towers)
parts += "[GLOB.round_statistics.points_from_towers] requisitions points gained from infestation towers."
//RUTGMC EDIT ADDITION END
if(GLOB.round_statistics.points_from_research)
parts += "[GLOB.round_statistics.points_from_research] requisitions points gained from research."
if(length(GLOB.round_statistics.req_items_produced))
Expand Down
6 changes: 6 additions & 0 deletions modular_RUtgmc/code/_globalvars/lists/objects.dm
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
GLOBAL_LIST_EMPTY(xeno_egg_hugger)

GLOBAL_LIST_EMPTY(miners_phorone)
GLOBAL_LIST_EMPTY(miners_platinum)

GLOBAL_LIST_EMPTY(miner_phorone_locs)
GLOBAL_LIST_EMPTY(miner_platinum_locs)
174 changes: 174 additions & 0 deletions modular_RUtgmc/code/datums/gamemodes/points_defence.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/datum/game_mode/infestation/distress/points_defence
name = "Points Defence"
config_tag = "Points Defence"
silo_scaling = 0.6 //do you really need a silo?

///The amount of sensor towers in sensor defence

var/sensors_activated = 0

var/victory_condition_sensors_amount
var/phorone_sensors
var/platinum_sensors

//larva points generation

var/larva_points_check_interval = 1 MINUTES
///Last time larva balance was checked
var/last_larva_points_check
///Ponderation rate of sensors output
var/sensors_larva_points_scaling = 2.4

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

/datum/game_mode/infestation/distress/points_defence/post_setup()
. = ..()

//delete miners
for(var/atom/A AS in GLOB.miners_phorone)
qdel(A)
for(var/atom/A AS in GLOB.miners_platinum)
qdel(A)

//number of sensors
//the number of sensors is greater than necessary to win, so that the late game does not turn into a 1 point defense
switch(TGS_CLIENT_COUNT)
if(1 to 15) //i dunno who will play it
victory_condition_sensors_amount = 2
phorone_sensors = 1
platinum_sensors = 1
if(16 to 30)
victory_condition_sensors_amount = 2
phorone_sensors = 1
platinum_sensors = 2
if(31 to 40)
victory_condition_sensors_amount = 3
phorone_sensors = 2
platinum_sensors = 2
if(41 to 50)
victory_condition_sensors_amount = 3
phorone_sensors = 1
platinum_sensors = 3
if(51 to 75)
victory_condition_sensors_amount = 4
phorone_sensors = 2
platinum_sensors = 3
if(76 to 100)
victory_condition_sensors_amount = 4
phorone_sensors = 1
platinum_sensors = 4
else //madness
victory_condition_sensors_amount = 5
phorone_sensors = 3
platinum_sensors = 3

//setip sensor towers
for(var/i in 1 to phorone_sensors)
var/turf/T = pick(GLOB.miner_phorone_locs)
new /obj/structure/sensor_tower_infestation(T)
GLOB.miner_phorone_locs -= T

for(var/i in 1 to platinum_sensors)
var/turf/T = pick(GLOB.miner_platinum_locs)
new /obj/structure/sensor_tower_infestation(T)
GLOB.miner_platinum_locs -= T

/datum/game_mode/infestation/distress/points_defence/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(sensors_activated >= victory_condition_sensors_amount)
message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines managed to activate all sensors
round_finished = MODE_INFESTATION_M_MAJOR
return TRUE

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(!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/points_defence/process()
. = ..()
if(world.time > last_larva_points_check + larva_points_check_interval)
add_larva_points()
last_larva_points_check = world.time

/datum/game_mode/infestation/distress/points_defence/proc/add_larva_points()
//prohibit generation before the shutters open
if(!SSsilo.can_fire)
return

//we should not spawn larvas on shipside
if(SSmonitor.gamestate == SHIPSIDE)
return

var/current_larva_spawn_rate = 0

var/datum/job/xeno_job = SSjob.GetJobType(/datum/job/xenomorph)
var/active_humans = length(GLOB.humans_by_zlevel["2"]) //we should not spawn larvas on shipside anyway
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 ++
current_larva_spawn_rate = (victory_condition_sensors_amount - sensors_activated) / victory_condition_sensors_amount
//We then are normalising with the number of alive marines, so the balance is roughly the same whether or not we are in high pop
current_larva_spawn_rate *= SILO_BASE_OUTPUT_PER_MARINE * active_humans
current_larva_spawn_rate *= sensors_larva_points_scaling
//We scale the rate based on the current ratio of humans to xenos
current_larva_spawn_rate *= clamp(round((active_humans / active_xenos) * (LARVA_POINTS_REGULAR / xeno_job.job_points_needed), 0.01), 0.5, 1.5)

GLOB.round_statistics.larva_from_towers += current_larva_spawn_rate / xeno_job.job_points_needed

xeno_job.add_job_points(current_larva_spawn_rate)

var/datum/hive_status/normal_hive = GLOB.hive_datums[XENO_HIVE_NORMAL]
normal_hive.update_tier_limits()

/datum/game_mode/infestation/distress/points_defence/siloless_hive_collapse()
return

/datum/game_mode/infestation/distress/points_defence/get_siloless_collapse_countdown()
return

/datum/game_mode/infestation/distress/points_defence/update_silo_death_timer(datum/hive_status/silo_owner)
return
3 changes: 3 additions & 0 deletions modular_RUtgmc/code/datums/round_statistics.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/round_statistics
var/larva_from_towers = 0
var/points_from_towers = 0
10 changes: 10 additions & 0 deletions modular_RUtgmc/code/game/objects/machinery/miner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
/obj/machinery/miner/Initialize(mapload)
. = ..()
camera = new /obj/machinery/camera/miner(src)
if(mineral_value >= PLATINUM_CRATE_SELL_AMOUNT)
GLOB.miners_platinum += src
GLOB.miner_platinum_locs += loc
else
GLOB.miners_phorone += src
GLOB.miner_phorone_locs += loc

/obj/machinery/miner/proc/set_miner_status()
var/health_percent = round((miner_integrity / max_miner_integrity) * 100)
Expand Down Expand Up @@ -31,6 +37,10 @@
/obj/machinery/miner/Destroy()
qdel(camera)
camera = null
if(mineral_value >= PLATINUM_CRATE_SELL_AMOUNT)
GLOB.miners_platinum -= src
else
GLOB.miners_phorone -= src
return ..()

/obj/machinery/miner/attack_ai(mob/user)
Expand Down
Loading
Loading