mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-20 11:40:07 +01:00
## About The Pull Request What it says on the tin. `times_fired` is the most unused parameter in all mob procs. I say most because there were just 2 cases where it was used - handling breathing - handling heartbeat Besides these 2 cases this parameter did nothing in every proc. Removing it does 2 things - Makes those procs more readable as it now has 1 less parameter that was documented poorly and did nothing - Makes those procs slightly faster as we are passing 1 less variable to its parameter call stack It can easily be substituted with `SSmobs.times_fired` which was its original value anyways ## Changelog 🆑 code: removes an unused parameter `times_fired` from mob life procs. Making them function slightly faster /🆑
45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
SUBSYSTEM_DEF(mobs)
|
|
name = "Mobs"
|
|
priority = FIRE_PRIORITY_MOBS
|
|
flags = SS_KEEP_TIMING | SS_NO_INIT
|
|
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
|
wait = 2 SECONDS
|
|
|
|
var/list/currentrun = list()
|
|
///only contains living players for some reason
|
|
var/static/list/clients_by_zlevel[][]
|
|
var/static/list/dead_players_by_zlevel[][] = list(list()) // Needs to support zlevel 1 here, MaxZChanged only happens when z2 is created and new_players can login before that.
|
|
var/static/list/cubemonkeys = list()
|
|
var/static/list/cheeserats = list()
|
|
|
|
/datum/controller/subsystem/mobs/stat_entry(msg)
|
|
msg = "P:[length(GLOB.mob_living_list)]"
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/mobs/proc/MaxZChanged()
|
|
if (!islist(clients_by_zlevel))
|
|
clients_by_zlevel = new /list(world.maxz,0)
|
|
dead_players_by_zlevel = new /list(world.maxz,0)
|
|
while (clients_by_zlevel.len < world.maxz)
|
|
clients_by_zlevel.len++
|
|
clients_by_zlevel[clients_by_zlevel.len] = list()
|
|
dead_players_by_zlevel.len++
|
|
dead_players_by_zlevel[dead_players_by_zlevel.len] = list()
|
|
|
|
/datum/controller/subsystem/mobs/fire(resumed = FALSE)
|
|
if (!resumed)
|
|
src.currentrun = GLOB.mob_living_list.Copy()
|
|
|
|
//cache for sanic speed (lists are references anyways)
|
|
var/list/currentrun = src.currentrun
|
|
var/seconds_per_tick = wait / (1 SECONDS)
|
|
while(currentrun.len)
|
|
var/mob/living/processing_mob = currentrun[currentrun.len]
|
|
currentrun.len--
|
|
if(processing_mob)
|
|
processing_mob.Life(seconds_per_tick)
|
|
else
|
|
GLOB.mob_living_list.Remove(processing_mob)
|
|
if (MC_TICK_CHECK)
|
|
return
|