-
-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- 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 Defines a small subsystem for turrets that fires every 5 ticks. Allows us to actually set turret fire rates that aren't bound to SSMachines will. Resolves #3407 <!-- 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 Turret Function :) <!-- Please add a short description of why you think these changes would benefit the game. If you can't justify it in words, it might not be worth adding. --> ## Changelog :cl: fix: Turrets should now actually fire at their defined fire rates. /:cl: <!-- Both :cl:'s are required for the changelog to work! You can put your name to the right of the first :cl: 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. --> --------- Signed-off-by: Erika Fox <[email protected]>
- Loading branch information
Showing
4 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
SUBSYSTEM_DEF(turrets) | ||
name = "Turrets" | ||
wait = 5 | ||
init_order = INIT_ORDER_MACHINES | ||
flags = SS_KEEP_TIMING | ||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME | ||
var/list/processing = list() | ||
var/list/currentrun = list() | ||
|
||
/datum/controller/subsystem/turrets/get_metrics() | ||
. = ..() | ||
var/list/cust = list() | ||
cust["processing"] = length(processing) | ||
.["custom"] = cust | ||
|
||
/datum/controller/subsystem/turrets/stat_entry(msg) | ||
msg = "M:[length(processing)]]" | ||
return ..() | ||
|
||
|
||
/datum/controller/subsystem/turrets/fire(resumed = 0) | ||
if (!resumed) | ||
src.currentrun = processing.Copy() | ||
|
||
//cache for sanic speed (lists are references anyways) | ||
var/list/currentrun = src.currentrun | ||
|
||
var/seconds = wait * 0.1 | ||
while(currentrun.len) | ||
var/obj/machinery/thing = currentrun[currentrun.len] | ||
currentrun.len-- | ||
if(QDELETED(thing) || thing.process(seconds) == PROCESS_KILL) | ||
processing -= thing | ||
if (!QDELETED(thing)) | ||
thing.datum_flags &= ~DF_ISPROCESSING | ||
if (MC_TICK_CHECK) | ||
return | ||
|
||
/datum/controller/subsystem/turrets/Recover() | ||
if (istype(SSturrets.processing)) | ||
processing = SSmachines.processing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters