Skip to content

Commit

Permalink
Adds time until the next abnormality arrives progress bar to the seph…
Browse files Browse the repository at this point in the history
…irah menu, frees sephirah menu buttons (#2611)

* frees the TGUI menu, adds time until arrival

* fixes the annoying TGUI linters
  • Loading branch information
Gboster-0 authored Dec 16, 2024
1 parent b432592 commit bd0a7aa
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 187 deletions.
3 changes: 2 additions & 1 deletion ModularTegustation/tegu_items/debug_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
*/
/obj/item/lc_debug/sephirah_action_granter
name = "debug sephirah action granter"
desc = "A strange wooden sign with the words\"THE ROBITS GRIFF ME!!!\" inscribed upon it"
desc = "A strange wooden sign with the words \"THE ROBITS GRIFF ME!!!\" inscribed upon it"
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "picket"

/obj/item/lc_debug/sephirah_action_granter/examine(mob/user)
Expand Down
21 changes: 12 additions & 9 deletions code/controllers/subsystem/abnormality_queue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ SUBSYSTEM_DEF(abnormality_queue)
var/rooms_start = 0
/// Amount of times PostSpawn() proc has been called. Kept separate from times_fired because admins love to call fire() manually
var/spawned_abnos = 0
/// When an abnormality spawns, the time it spawned is here. Purelly used for sephirahs TGUI console
var/previous_abno_spawn = 0
// I am using this all because default subsystem waiting and next_fire is done in a very... interesting way.
/// World time at which new abnormality will be spawned
var/next_abno_spawn = INFINITY
Expand Down Expand Up @@ -62,9 +64,10 @@ SUBSYSTEM_DEF(abnormality_queue)

/datum/controller/subsystem/abnormality_queue/proc/SpawnAbno()
// Earlier in the game, abnormalities will spawn faster and then slow down a bit
previous_abno_spawn = world.time
next_abno_spawn = world.time + next_abno_spawn_time + ((min(16, spawned_abnos) - 6) * 9) SECONDS

if(!LAZYLEN(GLOB.abnormality_room_spawners))
if(!length(GLOB.abnormality_room_spawners))
return

var/obj/effect/spawner/abnormality_room/choice = pick(GLOB.abnormality_room_spawners)
Expand Down Expand Up @@ -108,7 +111,7 @@ SUBSYSTEM_DEF(abnormality_queue)
available_levels = list(TETH_LEVEL)

// Roll the abnos from available levels
if(!ispath(queued_abnormality) && LAZYLEN(possible_abnormalities))
if(!ispath(queued_abnormality) && length(possible_abnormalities))
PickAbno()

/datum/controller/subsystem/abnormality_queue/proc/PostSpawn()
Expand Down Expand Up @@ -138,23 +141,23 @@ SUBSYSTEM_DEF(abnormality_queue)
to_chat(person, span_notice("You feel stronger than before."))

/datum/controller/subsystem/abnormality_queue/proc/PickAbno()
if(!LAZYLEN(available_levels))
if(!length(available_levels))
return FALSE
/// List of threat levels that we will pick
var/list/picking_levels = list()
for(var/threat in available_levels)
if(!LAZYLEN(possible_abnormalities[threat]))
if(!length(possible_abnormalities[threat]))
continue
picking_levels |= threat
if(!LAZYLEN(picking_levels))
if(!length(picking_levels))
return FALSE

// There we select the abnormalities
picking_abnormalities = list()
var/pick_count = GetFacilityUpgradeValue(UPGRADE_ABNO_QUEUE_COUNT)
var/list/picked_levs = list()
for(var/i = 1 to pick_count)
if(!LAZYLEN(possible_abnormalities))
if(!length(possible_abnormalities))
break
var/lev = pick(picking_levels)
// If we have more options to fill and we have multiple available levels - force them in.
Expand All @@ -164,11 +167,11 @@ SUBSYSTEM_DEF(abnormality_queue)
// And pick again
lev = pick(picking_levels)
picked_levs |= lev
if(!LAZYLEN(possible_abnormalities[lev] - picking_abnormalities))
if(!length(possible_abnormalities[lev] - picking_abnormalities))
continue
var/chosen_abno = PickWeightRealNumber(possible_abnormalities[lev] - picking_abnormalities)
picking_abnormalities += chosen_abno
if(!LAZYLEN(picking_abnormalities))
if(!length(picking_abnormalities))
return FALSE
queued_abnormality = pick(picking_abnormalities)
return TRUE
Expand Down Expand Up @@ -198,7 +201,7 @@ SUBSYSTEM_DEF(abnormality_queue)
var/list/picking_abno = list()

for(var/level in available_levels)
if(!LAZYLEN(possible_abnormalities[level]))
if(!length(possible_abnormalities[level]))
continue
picking_abno |= possible_abnormalities[level]

Expand Down
14 changes: 6 additions & 8 deletions code/modules/jobs/job_types/trusted_players/sephirah.dm
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,17 @@ GLOBAL_LIST_EMPTY(SephirahBullet)
var/mob/living/simple_animal/hostile/abnormality/queued_abno = SSabnormality_queue.queued_abnormality
data["queued_abno"] = initial(queued_abno.name)

/* Scrapped due to difficulty -- to be implemented
// START OF ARRIVAL INFORMATION
var/safe_abnormality_delay
if(SSabnormality_queue.next_abno_spawn != INFINITY) // happens when starting abnormalities are being selected, or things break
safe_abnormality_delay = SSabnormality_queue.next_abno_spawn
if(SSabnormality_queue.next_abno_spawn != INFINITY) // Happens when starting abnormalities are being selected, or things break
safe_abnormality_delay = floor(SSabnormality_queue.next_abno_spawn)
else
safe_abnormality_delay = ABNORMALITY_DELAY
safe_abnormality_delay = ABNORMALITY_DELAY + SSticker.round_start_time

data["current_arrival"] = safe_abnormality_delay
data["next_arrival"] = safe_abnormality_delay + SSabnormality_queue.next_abno_spawn_time + ((min(16, (SSabnormality_queue.spawned_abnos + 1)) - 6) * 6) SECONDS
data["progress_component"] = (world.time - ABNORMALITY_DELAY) / safe_abnormality_delay
data["previous_arrival_time"] = floor(SSabnormality_queue.previous_abno_spawn ? SSabnormality_queue.previous_abno_spawn : ROUNDTIME)
data["current_arrival_time"] = floor(world.time)
data["next_arrival_time"] = safe_abnormality_delay + 5 SECONDS // The seconds are because the subsystem fires every 10 seconds
// END OF ARRIVAL INFORMATION
*/

return data

Expand Down
Loading

0 comments on commit bd0a7aa

Please sign in to comment.