Skip to content

Commit

Permalink
defines + adds SSturrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Erikafox committed Sep 27, 2024
1 parent a358a4d commit 4b51a53
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
#define INIT_ORDER_ATOMS 30
#define INIT_ORDER_LANGUAGE 25
#define INIT_ORDER_MACHINES 20
#define INIT_ORDER_TURRETS 17
#define INIT_ORDER_SKILLS 15
#define INIT_ORDER_TIMER 1
#define INIT_ORDER_DEFAULT 0
Expand Down
41 changes: 41 additions & 0 deletions code/controllers/subsystem/turrets.dm
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
1 change: 1 addition & 0 deletions code/game/machinery/porta_turret/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ DEFINE_BITFIELD(turret_flags, list(
integrity_failure = 0.5
armor = list("melee" = 50, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90)
base_icon_state = "standard"
subsystem_type = /datum/controller/subsystem/turrets
/// Scan range of the turret for locating targets
var/scan_range = 7
/// For turrets inside other objects
Expand Down
1 change: 1 addition & 0 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
#include "code\controllers\subsystem\title.dm"
#include "code\controllers\subsystem\traumas.dm"
#include "code\controllers\subsystem\turf_fire.dm"
#include "code\controllers\subsystem\turrets.dm"
#include "code\controllers\subsystem\verb_manager.dm"
#include "code\controllers\subsystem\vis_overlays.dm"
#include "code\controllers\subsystem\vote.dm"
Expand Down

0 comments on commit 4b51a53

Please sign in to comment.