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

Increases pred round chance whenever it isn't a pred round #7201

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
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
22 changes: 22 additions & 0 deletions code/datums/entities/predround_chance.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/datum/entity/predround_chance
var/chance


/datum/entity_meta/predround_chance
entity_type = /datum/entity/predround_chance
table_name = "predround_chance"
field_types = list(
"chance" = DB_FIELDTYPE_BIGINT,
)

/datum/view_record/predround_chance
var/id
var/chance

/datum/entity_view_meta/stickyban
root_record_type = /datum/entity/predround_chance
destination_entity = /datum/view_record/predround_chance
fields = list(
"id",
"chance",
)
23 changes: 21 additions & 2 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,27 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
if(istype(CO_surv_job))
CO_surv_job.set_spawn_positions(GLOB.players_preassigned)

if(SSnightmare.get_scenario_value("predator_round") && !Check_WO())
var/chance
var/pred_round = FALSE
var/datum/view_record/predround_chance/meta = locate() in DB_VIEW(/datum/view_record/predround_chance, DB_COMP("id", DB_EQUALS, 1))
if(!meta)
var/datum/entity/predround_chance/entity = DB_ENTITY(/datum/entity/predround_chance, 1)
entity.chance = 0 // This is 0 instead of 20 because it is going to get increased in modify_pred_round_chance
chance = 20
entity.save()
else
chance = meta.chance

if(prob(chance) && !Check_WO())
pred_round = TRUE
SSticker.mode.flags_round_type |= MODE_PREDATOR
// Set predators starting amount based on marines assigned
var/datum/job/PJ = temp_roles_for_mode[JOB_PREDATOR]
if(istype(PJ))
PJ.set_spawn_positions(GLOB.players_preassigned)
REDIS_PUBLISH("byond.round", "type" = "predator-round", "map" = SSmapping.configs[GROUND_MAP].map_name)
REDIS_PUBLISH("byond.round", "type" = "predator-round", "map" = SSmapping.configs[GROUND_MAP].map_name)

DB_FILTER(/datum/entity/predround_chance, DB_COMP("id", DB_EQUALS, 1), CALLBACK(src, PROC_REF(modify_pred_round_chance), pred_round))

// Assign the roles, this time for real, respecting limits we have established.
var/list/roles_left = assign_roles(temp_roles_for_mode, unassigned_players)
Expand Down Expand Up @@ -823,3 +837,8 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
if(new_squad.num_tl >= new_squad.max_tl)
return TRUE
return FALSE

/datum/authority/branch/role/proc/modify_pred_round_chance(pred_round, list/datum/entity/predround_chance/entities)
var/datum/entity/predround_chance/entity = locate() in entities
entity.chance = pred_round ? 20 : entity.chance + 20
entity.save()
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@
#include "code\datums\entities\player_stat.dm"
#include "code\datums\entities\player_sticky_ban.dm"
#include "code\datums\entities\player_times.dm"
#include "code\datums\entities\predround_chance.dm"
#include "code\datums\entities\ticket.dm"
#include "code\datums\entities\logs\player_times_log.dm"
#include "code\datums\factions\clf.dm"
Expand Down
1 change: 0 additions & 1 deletion maps/Nightmare/scenario.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[
{ "type": "def", "values": { "predator_round": true }, "chance": 0.2 }
]
Loading