mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
VS: Convert bellies to processing subsystem
This commit is contained in:
@@ -1,55 +0,0 @@
|
|||||||
#define SSBELLIES_PROCESSED 1
|
|
||||||
#define SSBELLIES_IGNORED 2
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bellies subsystem - Process vore bellies
|
|
||||||
//
|
|
||||||
|
|
||||||
SUBSYSTEM_DEF(bellies)
|
|
||||||
name = "Bellies"
|
|
||||||
priority = 5
|
|
||||||
wait = 1 SECONDS
|
|
||||||
flags = SS_KEEP_TIMING|SS_NO_INIT
|
|
||||||
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
|
|
||||||
|
|
||||||
var/list/belly_list = list()
|
|
||||||
var/list/currentrun = list()
|
|
||||||
var/ignored_bellies = 0
|
|
||||||
var/obj/belly/current_belly
|
|
||||||
|
|
||||||
/datum/controller/subsystem/bellies/Recover()
|
|
||||||
log_debug("[name] subsystem Recover().")
|
|
||||||
if(SSbellies.current_belly)
|
|
||||||
log_debug("current_belly was: (\ref[SSbellies.current_belly])[SSbellies.current_belly]([SSbellies.current_belly.type])(SSbellies.current_belly.owner) - currentrun: [SSbellies.currentrun.len] vs total: [SSbellies.belly_list.len]")
|
|
||||||
var/list/old_bellies = SSbellies.belly_list.Copy()
|
|
||||||
for(var/datum/D in old_bellies)
|
|
||||||
if(!isbelly(D))
|
|
||||||
log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]")
|
|
||||||
belly_list |= D
|
|
||||||
|
|
||||||
/datum/controller/subsystem/bellies/stat_entry()
|
|
||||||
..("#: [belly_list.len] | P: [ignored_bellies]")
|
|
||||||
|
|
||||||
/datum/controller/subsystem/bellies/fire(resumed = 0)
|
|
||||||
if (!resumed)
|
|
||||||
ignored_bellies = 0
|
|
||||||
src.currentrun = belly_list.Copy()
|
|
||||||
|
|
||||||
//cache for sanic speed (lists are references anyways)
|
|
||||||
var/list/currentrun = src.currentrun
|
|
||||||
var/times_fired = src.times_fired
|
|
||||||
while(currentrun.len)
|
|
||||||
current_belly = currentrun[currentrun.len]
|
|
||||||
currentrun.len--
|
|
||||||
|
|
||||||
if(QDELETED(current_belly))
|
|
||||||
belly_list -= current_belly
|
|
||||||
else
|
|
||||||
if(current_belly.process_belly(times_fired,wait) == SSBELLIES_IGNORED)
|
|
||||||
ignored_bellies++
|
|
||||||
|
|
||||||
if (MC_TICK_CHECK)
|
|
||||||
current_belly = null
|
|
||||||
return
|
|
||||||
|
|
||||||
current_belly = null
|
|
||||||
20
code/controllers/subsystems/processing/bellies_vr.dm
Normal file
20
code/controllers/subsystems/processing/bellies_vr.dm
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Bellies subsystem - Process vore bellies
|
||||||
|
//
|
||||||
|
|
||||||
|
PROCESSING_SUBSYSTEM_DEF(bellies)
|
||||||
|
name = "Bellies"
|
||||||
|
wait = 6 SECONDS
|
||||||
|
flags = SS_KEEP_TIMING|SS_NO_INIT
|
||||||
|
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
|
||||||
|
|
||||||
|
/datum/controller/subsystem/processing/bellies/Recover()
|
||||||
|
log_debug("[name] subsystem Recover().")
|
||||||
|
if(SSbellies.current_thing)
|
||||||
|
log_debug("current_thing was: (\ref[SSbellies.current_thing])[SSbellies.current_thing]([SSbellies.current_thing.type]) - currentrun: [SSbellies.currentrun.len] vs total: [SSbellies.processing.len]")
|
||||||
|
var/list/old_processing = SSbellies.processing.Copy()
|
||||||
|
for(var/datum/D in old_processing)
|
||||||
|
if(!isbelly(D))
|
||||||
|
log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]")
|
||||||
|
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||||
|
processing |= D
|
||||||
@@ -55,9 +55,8 @@
|
|||||||
var/tmp/mob/living/owner // The mob whose belly this is.
|
var/tmp/mob/living/owner // The mob whose belly this is.
|
||||||
var/tmp/digest_mode = DM_HOLD // Current mode the belly is set to from digest_modes (+transform_modes if human)
|
var/tmp/digest_mode = DM_HOLD // Current mode the belly is set to from digest_modes (+transform_modes if human)
|
||||||
var/tmp/tf_mode = DM_TRANSFORM_REPLICA // Current transformation mode.
|
var/tmp/tf_mode = DM_TRANSFORM_REPLICA // Current transformation mode.
|
||||||
var/tmp/next_process = 0 // Waiting for this SSbellies times_fired to process again.
|
|
||||||
var/tmp/list/items_preserved = list() // Stuff that wont digest so we shouldn't process it again.
|
var/tmp/list/items_preserved = list() // Stuff that wont digest so we shouldn't process it again.
|
||||||
var/tmp/next_emote = 0 // When we're supposed to print our next emote, as a belly controller tick #
|
var/tmp/next_emote = 0 // When we're supposed to print our next emote, as a world.time
|
||||||
var/tmp/recent_sound = FALSE // Prevent audio spam
|
var/tmp/recent_sound = FALSE // Prevent audio spam
|
||||||
|
|
||||||
// Don't forget to watch your commas at the end of each line if you change these.
|
// Don't forget to watch your commas at the end of each line if you change these.
|
||||||
@@ -160,20 +159,20 @@
|
|||||||
"wet_loop"
|
"wet_loop"
|
||||||
)
|
)
|
||||||
|
|
||||||
/obj/belly/New(var/newloc)
|
/obj/belly/Initialize()
|
||||||
..(newloc)
|
. = ..()
|
||||||
//If not, we're probably just in a prefs list or something.
|
//If not, we're probably just in a prefs list or something.
|
||||||
if(isliving(newloc))
|
if(isliving(loc))
|
||||||
owner = loc
|
owner = loc
|
||||||
owner.vore_organs |= src
|
owner.vore_organs |= src
|
||||||
SSbellies.belly_list += src
|
START_PROCESSING(SSbellies, src)
|
||||||
|
|
||||||
/obj/belly/Destroy()
|
/obj/belly/Destroy()
|
||||||
SSbellies.belly_list -= src
|
STOP_PROCESSING(SSbellies, src)
|
||||||
if(owner)
|
if(owner)
|
||||||
owner.vore_organs -= src
|
owner.vore_organs -= src
|
||||||
owner = null
|
owner = null
|
||||||
. = ..()
|
return ..()
|
||||||
|
|
||||||
// Called whenever an atom enters this belly
|
// Called whenever an atom enters this belly
|
||||||
/obj/belly/Entered(atom/movable/thing, atom/OldLoc)
|
/obj/belly/Entered(atom/movable/thing, atom/OldLoc)
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
// Process the predator's effects upon the contents of its belly (i.e digestion/transformation etc)
|
// Process the predator's effects upon the contents of its belly (i.e digestion/transformation etc)
|
||||||
/obj/belly/proc/process_belly(times_fired, wait) //Passed by controller
|
/obj/belly/process(wait) //Passed by controller
|
||||||
if((times_fired < next_process) || !contents.len)
|
recent_sound = FALSE
|
||||||
recent_sound = FALSE
|
|
||||||
return SSBELLIES_IGNORED
|
|
||||||
|
|
||||||
if(loc != owner)
|
if(loc != owner)
|
||||||
if(istype(owner))
|
if(istype(owner))
|
||||||
loc = owner
|
loc = owner
|
||||||
else
|
else
|
||||||
qdel(src)
|
qdel(src)
|
||||||
return SSBELLIES_PROCESSED
|
return
|
||||||
|
|
||||||
next_process = times_fired + (6 SECONDS / wait) //Set up our next process time.
|
|
||||||
|
|
||||||
var/play_sound //Potential sound to play at the end to avoid code duplication.
|
var/play_sound //Potential sound to play at the end to avoid code duplication.
|
||||||
var/to_update = FALSE //Did anything update worthy happen?
|
var/to_update = FALSE //Did anything update worthy happen?
|
||||||
@@ -38,13 +34,13 @@
|
|||||||
/////////////////////////// Exit Early ////////////////////////////
|
/////////////////////////// Exit Early ////////////////////////////
|
||||||
var/list/touchable_atoms = contents - items_preserved
|
var/list/touchable_atoms = contents - items_preserved
|
||||||
if(!length(touchable_atoms))
|
if(!length(touchable_atoms))
|
||||||
return SSBELLIES_PROCESSED
|
return
|
||||||
|
|
||||||
var/list/touchable_mobs = list()
|
var/list/touchable_mobs = list()
|
||||||
|
|
||||||
///////////////////// Early Non-Mode Handling /////////////////////
|
///////////////////// Early Non-Mode Handling /////////////////////
|
||||||
if(contents.len && next_emote <= times_fired)
|
if(contents.len && next_emote <= world.time)
|
||||||
next_emote = times_fired + round(emote_time/wait,1)
|
next_emote = world.time + emote_time
|
||||||
var/list/EL = emote_lists[digest_mode]
|
var/list/EL = emote_lists[digest_mode]
|
||||||
if(LAZYLEN(EL))
|
if(LAZYLEN(EL))
|
||||||
for(var/mob/living/M in contents)
|
for(var/mob/living/M in contents)
|
||||||
@@ -107,7 +103,7 @@
|
|||||||
//We deliberately do not want any gurgly noises if the belly is in DM_HOLD
|
//We deliberately do not want any gurgly noises if the belly is in DM_HOLD
|
||||||
if(to_update)
|
if(to_update)
|
||||||
updateVRPanels()
|
updateVRPanels()
|
||||||
return SSBELLIES_PROCESSED
|
return
|
||||||
|
|
||||||
if(digest_mode == DM_TRANSFORM)
|
if(digest_mode == DM_TRANSFORM)
|
||||||
process_tf(tf_mode, touchable_mobs)
|
process_tf(tf_mode, touchable_mobs)
|
||||||
@@ -221,7 +217,7 @@
|
|||||||
if(to_update)
|
if(to_update)
|
||||||
updateVRPanels()
|
updateVRPanels()
|
||||||
|
|
||||||
return SSBELLIES_PROCESSED
|
return
|
||||||
|
|
||||||
/obj/belly/proc/prey_loop()
|
/obj/belly/proc/prey_loop()
|
||||||
for(var/mob/living/M in contents)
|
for(var/mob/living/M in contents)
|
||||||
|
|||||||
@@ -233,7 +233,6 @@
|
|||||||
#include "code\controllers\subsystems\airflow.dm"
|
#include "code\controllers\subsystems\airflow.dm"
|
||||||
#include "code\controllers\subsystems\assets.dm"
|
#include "code\controllers\subsystems\assets.dm"
|
||||||
#include "code\controllers\subsystems\atoms.dm"
|
#include "code\controllers\subsystems\atoms.dm"
|
||||||
#include "code\controllers\subsystems\bellies_vr.dm"
|
|
||||||
#include "code\controllers\subsystems\character_setup.dm"
|
#include "code\controllers\subsystems\character_setup.dm"
|
||||||
#include "code\controllers\subsystems\chat.dm"
|
#include "code\controllers\subsystems\chat.dm"
|
||||||
#include "code\controllers\subsystems\circuits.dm"
|
#include "code\controllers\subsystems\circuits.dm"
|
||||||
@@ -262,6 +261,7 @@
|
|||||||
#include "code\controllers\subsystems\transcore_vr.dm"
|
#include "code\controllers\subsystems\transcore_vr.dm"
|
||||||
#include "code\controllers\subsystems\vote.dm"
|
#include "code\controllers\subsystems\vote.dm"
|
||||||
#include "code\controllers\subsystems\xenoarch.dm"
|
#include "code\controllers\subsystems\xenoarch.dm"
|
||||||
|
#include "code\controllers\subsystems\processing\bellies_vr.dm"
|
||||||
#include "code\controllers\subsystems\processing\chemistry.dm"
|
#include "code\controllers\subsystems\processing\chemistry.dm"
|
||||||
#include "code\controllers\subsystems\processing\fastprocess.dm"
|
#include "code\controllers\subsystems\processing\fastprocess.dm"
|
||||||
#include "code\controllers\subsystems\processing\obj.dm"
|
#include "code\controllers\subsystems\processing\obj.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user