Files
LordMEandGitHub da0eb918ef opendream fixes (#6809)
…l-Station-13-RP into opendream_branch<!-- Write **BELOW** The Headers
and **ABOVE** The comments else it may not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
adjusts the repo to work with opendream
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
a more modern, and hopefully more reliable engine!!!
<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
code: changed the code to work with Opendream
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
2024-11-05 10:12:18 -05:00

56 lines
1.4 KiB
Plaintext

//
// Mobs Subsystem - Process mob.Life()
//
// Contains temporary debugging code to diagnose extreme tick consumption.
SUBSYSTEM_DEF(mobs)
name = "Mobs"
priority = 100
wait = 2 SECONDS
subsystem_flags = SS_KEEP_TIMING|SS_NO_INIT
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/currentrun = list()
var/log_extensively = FALSE
var/list/timelog = list()
var/list/busy_z_levels = list()
var/slept_mobs = 0
/datum/controller/subsystem/mobs/stat_entry()
return ..() + " P: [GLOB.mob_list.len] | S: [slept_mobs]"
/datum/controller/subsystem/mobs/fire(resumed = 0)
var/list/busy_z_levels = src.busy_z_levels
if (!resumed)
slept_mobs = 0
src.currentrun = GLOB.mob_list.Copy()
busy_z_levels.Cut()
for(var/played_mob in GLOB.player_list)
if(!played_mob || isobserver(played_mob))
continue
var/mob/pm = played_mob
busy_z_levels |= pm.z
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
var/times_fired = src.times_fired
var/dt = nominal_dt_s
while(currentrun.len)
var/mob/M = currentrun[currentrun.len]
currentrun.len--
if(QDELETED(M))
GLOB.mob_list -= M
else
// Right now mob.Life() is unstable enough I think we need to use a try catch.
// Obviously we should try and get rid of this for performance reasons when we can.
if(M.low_priority && !(M.z in busy_z_levels))
slept_mobs++
continue
M.Life(dt, times_fired)
if (MC_TICK_CHECK)
return