-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3709 from MistakeNot4892/feature/viscontents
Moving vis_contents changes onto a subsystem.
- Loading branch information
Showing
21 changed files
with
148 additions
and
66 deletions.
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
This file was deleted.
Oops, something went wrong.
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
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
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,93 @@ | ||
SUBSYSTEM_DEF(vis_contents_update) | ||
name = "Vis Contents" | ||
flags = SS_BACKGROUND | ||
wait = 1 | ||
priority = SS_PRIORITY_VIS_CONTENTS | ||
init_order = SS_INIT_VIS_CONTENTS | ||
runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT | ||
var/list/queue_refs = list() | ||
|
||
/datum/controller/subsystem/vis_contents_update/stat_entry() | ||
..("Queue: [queue_refs.len]") | ||
|
||
/datum/controller/subsystem/vis_contents_update/Initialize() | ||
fire(FALSE, TRUE) | ||
|
||
/datum/controller/subsystem/vis_contents_update/StartLoadingMap() | ||
suspend() | ||
|
||
/datum/controller/subsystem/vis_contents_update/StopLoadingMap() | ||
wake() | ||
|
||
// Largely copied from SSicon_update. | ||
/datum/controller/subsystem/vis_contents_update/fire(resumed = FALSE, no_mc_tick = FALSE) | ||
if(!queue_refs.len) | ||
suspend() | ||
return | ||
var/i = 0 | ||
while (i < queue_refs.len) | ||
i++ | ||
var/atom/A = queue_refs[i] | ||
if(QDELETED(A)) | ||
continue | ||
if(Master.map_loading) | ||
queue_refs.Cut(1, i+1) | ||
return | ||
A.vis_update_queued = FALSE | ||
A.update_vis_contents(force_no_queue = TRUE) | ||
if (no_mc_tick) | ||
CHECK_TICK | ||
else if (MC_TICK_CHECK) | ||
queue_refs.Cut(1, i+1) | ||
return | ||
queue_refs.Cut() | ||
|
||
/atom | ||
var/vis_update_queued = FALSE | ||
|
||
/atom/proc/queue_vis_contents_update() | ||
if(vis_update_queued) | ||
return | ||
vis_update_queued = TRUE | ||
SSvis_contents_update.queue_refs.Add(src) | ||
SSvis_contents_update.wake() | ||
|
||
// Horrible colon syntax below is because vis_contents | ||
// exists in /atom.vars, but will not compile. No idea why. | ||
/atom/proc/add_vis_contents(adding) | ||
src:vis_contents |= adding | ||
|
||
/atom/proc/remove_vis_contents(removing) | ||
src:vis_contents -= removing | ||
|
||
/atom/proc/clear_vis_contents() | ||
src:vis_contents = null | ||
|
||
/atom/proc/set_vis_contents(list/adding) | ||
src:vis_contents = adding | ||
|
||
/atom/proc/get_vis_contents_to_add() | ||
return | ||
|
||
/atom/proc/update_vis_contents(force_no_queue = FALSE) | ||
if(!force_no_queue && (!SSvis_contents_update.initialized || TICK_CHECK)) | ||
queue_vis_contents_update() | ||
return | ||
vis_update_queued = FALSE | ||
var/new_vis_contents = get_vis_contents_to_add() | ||
if(length(new_vis_contents)) | ||
set_vis_contents(new_vis_contents) | ||
else if(length(src:vis_contents)) | ||
clear_vis_contents() | ||
|
||
/image/proc/add_vis_contents(adding) | ||
vis_contents |= adding | ||
|
||
/image/proc/remove_vis_contents(removing) | ||
vis_contents -= removing | ||
|
||
/image/proc/clear_vis_contents() | ||
vis_contents.Cut() | ||
|
||
/image/proc/set_vis_contents(list/adding) | ||
vis_contents = adding |
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
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
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
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
Oops, something went wrong.