Allows soft-disabling of flightsuit processing, moves subsystem defines to subsystems.dm (#25513)

This commit is contained in:
kevinz000
2017-03-30 05:07:49 -07:00
committed by Leo
parent 8bc2912bff
commit d17aacc8cd
5 changed files with 58 additions and 21 deletions

View File

@@ -51,19 +51,3 @@
#define SS_PAUSED 3 //paused by mc_tick_check #define SS_PAUSED 3 //paused by mc_tick_check
#define SS_SLEEPING 4 //fire() slept. #define SS_SLEEPING 4 //fire() slept.
#define SS_PAUSING 5 //in the middle of pausing #define SS_PAUSING 5 //in the middle of pausing
//Timing subsystem
//Don't run if there is an identical unique timer active
#define TIMER_UNIQUE 0x1
//For unique timers: Replace the old timer rather then not start this one
#define TIMER_OVERRIDE 0x2
//Timing should be based on how timing progresses on clients, not the sever.
// tracking this is more expensive,
// should only be used in conjuction with things that have to progress client side, such as animate() or sound()
#define TIMER_CLIENT_TIME 0x4
//Timer can be stopped using deltimer()
#define TIMER_STOPPABLE 0x8
//To be used with TIMER_UNIQUE
//prevents distinguishing identical timers with the wait variable
#define TIMER_NO_HASH_WAIT 0x10

View File

@@ -0,0 +1,19 @@
//Timing subsystem
//Don't run if there is an identical unique timer active
#define TIMER_UNIQUE 0x1
//For unique timers: Replace the old timer rather then not start this one
#define TIMER_OVERRIDE 0x2
//Timing should be based on how timing progresses on clients, not the sever.
// tracking this is more expensive,
// should only be used in conjuction with things that have to progress client side, such as animate() or sound()
#define TIMER_CLIENT_TIME 0x4
//Timer can be stopped using deltimer()
#define TIMER_STOPPABLE 0x8
//To be used with TIMER_UNIQUE
//prevents distinguishing identical timers with the wait variable
#define TIMER_NO_HASH_WAIT 0x10
//For servers that can't do with any additional lag, set this to none in flightpacks.dm in subsystem/processing.
#define FLIGHTSUIT_PROCESSING_NONE 0
#define FLIGHTSUIT_PROCESSING_FULL 1

View File

@@ -6,6 +6,24 @@ var/datum/controller/subsystem/processing/flightpacks/SSflightpacks
wait = 2 wait = 2
stat_tag = "FM" stat_tag = "FM"
flags = SS_NO_INIT|SS_TICKER|SS_KEEP_TIMING flags = SS_NO_INIT|SS_TICKER|SS_KEEP_TIMING
var/flightsuit_processing = FLIGHTSUIT_PROCESSING_FULL
/datum/controller/subsystem/processing/flightpacks/New() /datum/controller/subsystem/processing/flightpacks/New()
NEW_SS_GLOBAL(SSflightpacks) NEW_SS_GLOBAL(SSflightpacks)
/datum/controller/subsystem/processing/flightpacks/Initialize()
sync_flightsuit_processing()
/datum/controller/subsystem/processing/flightpacks/vv_edit_var(var_name, var_value)
..()
switch(var_name)
if("flightsuit_processing")
sync_flightsuit_processing()
/datum/controller/subsystem/processing/flightpacks/proc/sync_flightsuit_processing()
for(var/obj/item/device/flightpack/FP in processing)
FP.sync_processing(src)
if(flightsuit_processing == FLIGHTSUIT_PROCESSING_NONE) //Don't even bother firing.
can_fire = FALSE
else
can_fire = TRUE

View File

@@ -24,6 +24,8 @@
slot_flags = SLOT_BACK slot_flags = SLOT_BACK
resistance_flags = FIRE_PROOF resistance_flags = FIRE_PROOF
var/processing_mode = FLIGHTSUIT_PROCESSING_FULL
var/obj/item/clothing/suit/space/hardsuit/flightsuit/suit = null var/obj/item/clothing/suit/space/hardsuit/flightsuit/suit = null
var/mob/living/carbon/human/wearer = null var/mob/living/carbon/human/wearer = null
var/slowdown_ground = 1 var/slowdown_ground = 1
@@ -104,14 +106,15 @@
//Start/Stop processing the item to use momentum and flight mechanics. //Start/Stop processing the item to use momentum and flight mechanics.
/obj/item/device/flightpack/New() /obj/item/device/flightpack/Initialize()
ion_trail = new ion_trail = new
ion_trail.set_up(src) ion_trail.set_up(src)
START_PROCESSING(SSflightpacks, src) START_PROCESSING(SSflightpacks, src)
..()
update_parts() update_parts()
sync_processing(SSflightpacks)
..()
/obj/item/device/flightpack/full/New() /obj/item/device/flightpack/full/Initialize()
part_manip = new /obj/item/weapon/stock_parts/manipulator/pico(src) part_manip = new /obj/item/weapon/stock_parts/manipulator/pico(src)
part_scan = new /obj/item/weapon/stock_parts/scanning_module/phasic(src) part_scan = new /obj/item/weapon/stock_parts/scanning_module/phasic(src)
part_cap = new /obj/item/weapon/stock_parts/capacitor/super(src) part_cap = new /obj/item/weapon/stock_parts/capacitor/super(src)
@@ -120,6 +123,18 @@
assembled = TRUE assembled = TRUE
..() ..()
/obj/item/device/flightpack/proc/sync_processing(datum/controller/subsystem/processing/flightpacks/FPS)
processing_mode = FPS.flightsuit_processing
if(processing_mode == FLIGHTSUIT_PROCESSING_NONE)
momentum_x = 0
momentum_y = 0
momentum_speed_x = 0
momentum_speed_y = 0
momentum_speed = 0
boost_charge = 0
boost = FALSE
update_slowdown()
/obj/item/device/flightpack/proc/update_parts() /obj/item/device/flightpack/proc/update_parts()
boost_chargerate = initial(boost_chargerate) boost_chargerate = initial(boost_chargerate)
boost_drain = initial(boost_drain) boost_drain = initial(boost_drain)
@@ -339,7 +354,7 @@
suit.slowdown = slowdown_air suit.slowdown = slowdown_air
/obj/item/device/flightpack/process() /obj/item/device/flightpack/process()
if(!suit) if(!suit || (processing_mode == FLIGHTSUIT_PROCESSING_NONE))
return FALSE return FALSE
update_slowdown() update_slowdown()
update_icon() update_icon()
@@ -451,7 +466,7 @@
wearer.visible_message("[wearer] is knocked flying by the impact!") wearer.visible_message("[wearer] is knocked flying by the impact!")
/obj/item/device/flightpack/proc/flight_impact(atom/unmovablevictim, crashdir) //Yes, victim. /obj/item/device/flightpack/proc/flight_impact(atom/unmovablevictim, crashdir) //Yes, victim.
if((unmovablevictim == wearer) || crashing) if((unmovablevictim == wearer) || crashing || (processing_mode == FLIGHTSUIT_PROCESSING_NONE))
return FALSE return FALSE
crashing = TRUE crashing = TRUE
var/crashpower = 0 var/crashpower = 0

View File

@@ -56,6 +56,7 @@
#include "code\__DEFINES\shuttles.dm" #include "code\__DEFINES\shuttles.dm"
#include "code\__DEFINES\sight.dm" #include "code\__DEFINES\sight.dm"
#include "code\__DEFINES\sound.dm" #include "code\__DEFINES\sound.dm"
#include "code\__DEFINES\subsystems.dm"
#include "code\__DEFINES\stat.dm" #include "code\__DEFINES\stat.dm"
#include "code\__DEFINES\status_effects.dm" #include "code\__DEFINES\status_effects.dm"
#include "code\__DEFINES\tgui.dm" #include "code\__DEFINES\tgui.dm"