mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-25 06:06:34 +01:00
Merge branch 'master' of https://github.com/PolarisSS13/Polaris into 2/17/2018_make_AI_great_again
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
for(last_object in clients)
|
||||
var/client/C = last_object
|
||||
if(C.is_afk(config.kick_inactive MINUTES))
|
||||
if(!istype(C.mob, /mob/observer/dead) && !istype(C.mob, /mob/new_player))
|
||||
to_chat(C,"<span class='warning'>You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected.</span>")
|
||||
var/information
|
||||
to_chat(C,"<span class='warning'>You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected.</span>")
|
||||
var/information
|
||||
|
||||
if(C.mob)
|
||||
if(ishuman(C.mob))
|
||||
var/job
|
||||
var/mob/living/carbon/human/H = C.mob
|
||||
@@ -27,10 +27,10 @@
|
||||
else if(issilicon(C.mob))
|
||||
information = " while a silicon."
|
||||
|
||||
var/adminlinks
|
||||
adminlinks = " (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[C.mob.x];Y=[C.mob.y];Z=[C.mob.z]'>JMP</a>|<A HREF='?_src_=holder;cryoplayer=\ref[C.mob]'>CRYO</a>)"
|
||||
var/adminlinks
|
||||
adminlinks = " (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[C.mob.x];Y=[C.mob.y];Z=[C.mob.z]'>JMP</a>|<A HREF='?_src_=holder;cryoplayer=\ref[C.mob]'>CRYO</a>)"
|
||||
|
||||
log_and_message_admins("being kicked for AFK[information][adminlinks]", C.mob)
|
||||
log_and_message_admins("being kicked for AFK[information][adminlinks]", C.mob)
|
||||
|
||||
qdel(C)
|
||||
qdel(C)
|
||||
SCHECK
|
||||
|
||||
@@ -47,7 +47,8 @@ var/datum/controller/process/planet/planet_controller = null
|
||||
//Weather style needs redrawing
|
||||
if(P.needs_work & PLANET_PROCESS_WEATHER)
|
||||
P.needs_work &= ~PLANET_PROCESS_WEATHER
|
||||
var/image/new_overlay = image(icon = P.weather_holder.current_weather.icon, icon_state = P.weather_holder.current_weather.icon_state, layer = LIGHTING_LAYER - 1)
|
||||
var/image/new_overlay = image(icon = P.weather_holder.current_weather.icon, icon_state = P.weather_holder.current_weather.icon_state)
|
||||
new_overlay.plane = PLANE_PLANETLIGHTING
|
||||
//Redraw weather icons
|
||||
for(var/T in P.planet_floors)
|
||||
var/turf/simulated/turf = T
|
||||
|
||||
@@ -8,19 +8,21 @@
|
||||
|
||||
/datum/controller/process/scheduler/setup()
|
||||
name = "scheduler"
|
||||
schedule_interval = 3 SECONDS
|
||||
schedule_interval = 1 SECOND
|
||||
scheduled_tasks = list()
|
||||
scheduler = src
|
||||
|
||||
/datum/controller/process/scheduler/doWork()
|
||||
var/world_time = world.time
|
||||
for(last_object in scheduled_tasks)
|
||||
var/datum/scheduled_task/scheduled_task = last_object
|
||||
if(world_time < scheduled_task.trigger_time)
|
||||
break // Too early for this one, and therefore too early for all remaining.
|
||||
try
|
||||
if(world.time > scheduled_task.trigger_time)
|
||||
unschedule(scheduled_task)
|
||||
scheduled_task.pre_process()
|
||||
scheduled_task.process()
|
||||
scheduled_task.post_process()
|
||||
unschedule(scheduled_task)
|
||||
scheduled_task.pre_process()
|
||||
scheduled_task.process()
|
||||
scheduled_task.post_process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, last_object)
|
||||
SCHECK
|
||||
@@ -45,7 +47,7 @@
|
||||
stat(null, "[scheduled_tasks.len] task\s")
|
||||
|
||||
/datum/controller/process/scheduler/proc/schedule(var/datum/scheduled_task/st)
|
||||
scheduled_tasks += st
|
||||
dd_insertObjectList(scheduled_tasks, st)
|
||||
|
||||
/datum/controller/process/scheduler/proc/unschedule(var/datum/scheduled_task/st)
|
||||
scheduled_tasks -= st
|
||||
@@ -106,6 +108,9 @@
|
||||
task_after_process_args.Cut()
|
||||
return ..()
|
||||
|
||||
/datum/scheduled_task/dd_SortValue()
|
||||
return trigger_time
|
||||
|
||||
/datum/scheduled_task/proc/pre_process()
|
||||
task_triggered_event.raise_event(list(src))
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ var/list/gamemode_cache = list()
|
||||
|
||||
var/starlight = 0 // Whether space turfs have ambient light or not
|
||||
|
||||
var/list/ert_species = list("Human")
|
||||
var/list/ert_species = list(SPECIES_HUMAN)
|
||||
|
||||
var/law_zero = "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'ALL LAWS OVERRIDDEN#*?&110010"
|
||||
|
||||
@@ -721,7 +721,7 @@ var/list/gamemode_cache = list()
|
||||
if("ert_species")
|
||||
config.ert_species = splittext(value, ";")
|
||||
if(!config.ert_species.len)
|
||||
config.ert_species += "Human"
|
||||
config.ert_species += SPECIES_HUMAN
|
||||
|
||||
if("law_zero")
|
||||
law_zero = value
|
||||
|
||||
@@ -234,7 +234,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
||||
name = "star"
|
||||
var/speed = 10
|
||||
var/direction = SOUTH
|
||||
layer = 2 // TURF_LAYER
|
||||
layer = TURF_LAYER
|
||||
plane = TURF_PLANE
|
||||
|
||||
/obj/effect/bgstar/New()
|
||||
..()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
SUBSYSTEM_DEF(air)
|
||||
name = "Air"
|
||||
init_order = INIT_ORDER_AIR
|
||||
priority = 20
|
||||
priority = 35
|
||||
wait = 2 SECONDS // seconds (We probably can speed this up actually)
|
||||
flags = SS_BACKGROUND // TODO - Should this really be background? It might be important.
|
||||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
||||
|
||||
@@ -14,7 +14,7 @@ SUBSYSTEM_DEF(airflow)
|
||||
wait = 2
|
||||
flags = SS_NO_INIT
|
||||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
||||
priority = 15
|
||||
priority = 30
|
||||
|
||||
var/list/processing = list()
|
||||
var/list/currentrun = list()
|
||||
@@ -47,7 +47,7 @@ SUBSYSTEM_DEF(airflow)
|
||||
continue
|
||||
else if (target.airflow_process_delay)
|
||||
target.airflow_process_delay = 0
|
||||
|
||||
|
||||
target.airflow_speed = min(target.airflow_speed, 15)
|
||||
target.airflow_speed -= vsc.airflow_speed_decay
|
||||
if (!target.airflow_skip_speedcheck)
|
||||
@@ -89,7 +89,7 @@ SUBSYSTEM_DEF(airflow)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
continue
|
||||
|
||||
|
||||
step_towards(target, target.airflow_dest)
|
||||
var/mob/M = target
|
||||
if (ismob(target) && M.client)
|
||||
@@ -98,7 +98,7 @@ SUBSYSTEM_DEF(airflow)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
#undef CLEAR_OBJECT
|
||||
#undef CLEAR_OBJECT
|
||||
|
||||
/atom/movable
|
||||
var/tmp/airflow_xo
|
||||
@@ -129,9 +129,9 @@ SUBSYSTEM_DEF(airflow)
|
||||
if (airflow_falloff < 1)
|
||||
airflow_dest = null
|
||||
return FALSE
|
||||
|
||||
airflow_speed = min(max(n * (9 / airflow_falloff), 1), 9)
|
||||
|
||||
|
||||
airflow_speed = min(max(n * (9 / airflow_falloff), 1), 9)
|
||||
|
||||
airflow_od = 0
|
||||
|
||||
if (!density)
|
||||
@@ -154,7 +154,7 @@ SUBSYSTEM_DEF(airflow)
|
||||
/atom/movable/proc/RepelAirflowDest(n)
|
||||
if (!prepare_airflow(n))
|
||||
return
|
||||
|
||||
|
||||
airflow_xo = -(airflow_dest.x - src.x)
|
||||
airflow_yo = -(airflow_dest.y - src.y)
|
||||
|
||||
|
||||
@@ -135,9 +135,7 @@ SUBSYSTEM_DEF(atoms)
|
||||
/datum/controller/subsystem/atoms/Shutdown()
|
||||
var/initlog = InitLog()
|
||||
if(initlog)
|
||||
//text2file(initlog, "[GLOB.log_directory]/initialize.log")
|
||||
var/date_string = time2text(world.realtime, "YYYY/MM-Month/DD-Day")
|
||||
text2file(initlog, "data/logs/[date_string]-initialize.log")
|
||||
text2file(initlog, "[log_path]-initialize.log")
|
||||
|
||||
#undef BAD_INIT_QDEL_BEFORE
|
||||
#undef BAD_INIT_DIDNT_INIT
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
//
|
||||
// Floor Decals Initialization Subsystem
|
||||
// This is part of the giant decal hack that works around a BYOND bug where DreamDaemon will crash if you
|
||||
// update overlays on turfs too much.
|
||||
// The master_controller on Polaris used to init decals prior to initializing areas (which initilized turfs)
|
||||
// Now that we switched to subsystems we still want to do the same thing, so this takes care of it.
|
||||
//
|
||||
SUBSYSTEM_DEF(floor_decals)
|
||||
name = "Floor Decals"
|
||||
init_order = INIT_ORDER_DECALS
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
/datum/controller/subsystem/floor_decals/Initialize(timeofday)
|
||||
if(floor_decals_initialized)
|
||||
return ..()
|
||||
to_world_log("Initializing Floor Decals")
|
||||
admin_notice("<span class='danger'>Initializing Floor Decals</span>", R_DEBUG)
|
||||
var/list/turfs_with_decals = list()
|
||||
for(var/obj/effect/floor_decal/D in world)
|
||||
var/T = D.add_to_turf_decals()
|
||||
if(T) turfs_with_decals |= T
|
||||
CHECK_TICK
|
||||
for(var/item in turfs_with_decals)
|
||||
var/turf/T = item
|
||||
if(T.decals) T.apply_decals()
|
||||
CHECK_TICK
|
||||
floor_decals_initialized = TRUE
|
||||
return ..()
|
||||
@@ -81,7 +81,7 @@ SUBSYSTEM_DEF(garbage)
|
||||
dellog += "\tIgnored force: [I.no_respect_force] times"
|
||||
if (I.no_hint)
|
||||
dellog += "\tNo hint: [I.no_hint] times"
|
||||
log_misc(dellog.Join())
|
||||
text2file(dellog.Join(), "[log_path]-qdel.log")
|
||||
|
||||
/datum/controller/subsystem/garbage/fire()
|
||||
//the fact that this resets its processing each fire (rather then resume where it left off) is intentional.
|
||||
@@ -169,7 +169,12 @@ SUBSYSTEM_DEF(garbage)
|
||||
#endif
|
||||
var/type = D.type
|
||||
var/datum/qdel_item/I = items[type]
|
||||
testing("GC: -- \ref[D] | [type] was unable to be GC'd --")
|
||||
var/extrainfo = "--"
|
||||
if(istype(D,/image))
|
||||
var/image/img = D
|
||||
var/icon/ico = img.icon
|
||||
extrainfo = "L:[img.loc] -- I:[ico] -- IS:[img.icon_state] --"
|
||||
testing("GC: -- \ref[D] | [type] was unable to be GC'd [extrainfo]")
|
||||
I.failures++
|
||||
if (GC_QUEUE_HARDDELETE)
|
||||
HardDelete(D)
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
SUBSYSTEM_DEF(overlays)
|
||||
name = "Overlay"
|
||||
flags = SS_TICKER
|
||||
wait = 1
|
||||
priority = FIRE_PRIORITY_OVERLAYS
|
||||
init_order = INIT_ORDER_OVERLAY
|
||||
|
||||
var/initialized = FALSE
|
||||
var/list/queue // Queue of atoms needing overlay compiling (TODO-VERIFY!)
|
||||
var/list/stats
|
||||
var/list/overlay_icon_state_caches // Cache thing
|
||||
var/list/overlay_icon_cache // Cache thing
|
||||
|
||||
var/global/image/stringbro = new() // Temporarily super-global because of BYOND init order dumbness.
|
||||
var/global/image/iconbro = new() // Temporarily super-global because of BYOND init order dumbness.
|
||||
var/global/image/appearance_bro = new() // Temporarily super-global because of BYOND init order dumbness.
|
||||
|
||||
/datum/controller/subsystem/overlays/PreInit()
|
||||
overlay_icon_state_caches = list()
|
||||
overlay_icon_cache = list()
|
||||
queue = list()
|
||||
stats = list()
|
||||
|
||||
/datum/controller/subsystem/overlays/Initialize()
|
||||
initialized = TRUE
|
||||
fire(mc_check = FALSE)
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/overlays/stat_entry()
|
||||
..("Ov:[length(queue)]")
|
||||
|
||||
|
||||
/datum/controller/subsystem/overlays/Shutdown()
|
||||
text2file(render_stats(stats), "[log_path]-overlay.log")
|
||||
|
||||
/datum/controller/subsystem/overlays/Recover()
|
||||
overlay_icon_state_caches = SSoverlays.overlay_icon_state_caches
|
||||
overlay_icon_cache = SSoverlays.overlay_icon_cache
|
||||
queue = SSoverlays.queue
|
||||
|
||||
|
||||
/datum/controller/subsystem/overlays/fire(resumed = FALSE, mc_check = TRUE)
|
||||
var/list/queue = src.queue
|
||||
var/static/count = 0
|
||||
if (count)
|
||||
var/c = count
|
||||
count = 0 //so if we runtime on the Cut, we don't try again.
|
||||
queue.Cut(1,c+1)
|
||||
|
||||
for (var/thing in queue)
|
||||
count++
|
||||
if(thing)
|
||||
STAT_START_STOPWATCH
|
||||
var/atom/A = thing
|
||||
COMPILE_OVERLAYS(A)
|
||||
STAT_STOP_STOPWATCH
|
||||
STAT_LOG_ENTRY(stats, A.type)
|
||||
if(mc_check)
|
||||
if(MC_TICK_CHECK)
|
||||
break
|
||||
else
|
||||
CHECK_TICK
|
||||
|
||||
if (count)
|
||||
queue.Cut(1,count+1)
|
||||
count = 0
|
||||
|
||||
/proc/iconstate2appearance(icon, iconstate)
|
||||
// var/static/image/stringbro = new() // Moved to be superglobal due to BYOND insane init order stupidness.
|
||||
var/list/icon_states_cache = SSoverlays.overlay_icon_state_caches
|
||||
var/list/cached_icon = icon_states_cache[icon]
|
||||
if (cached_icon)
|
||||
var/cached_appearance = cached_icon["[iconstate]"]
|
||||
if (cached_appearance)
|
||||
return cached_appearance
|
||||
stringbro.icon = icon
|
||||
stringbro.icon_state = iconstate
|
||||
if (!cached_icon) //not using the macro to save an associated lookup
|
||||
cached_icon = list()
|
||||
icon_states_cache[icon] = cached_icon
|
||||
var/cached_appearance = stringbro.appearance
|
||||
cached_icon["[iconstate]"] = cached_appearance
|
||||
return cached_appearance
|
||||
|
||||
/proc/icon2appearance(icon)
|
||||
// var/static/image/iconbro = new() // Moved to be superglobal due to BYOND insane init order stupidness.
|
||||
var/list/icon_cache = SSoverlays.overlay_icon_cache
|
||||
. = icon_cache[icon]
|
||||
if (!.)
|
||||
iconbro.icon = icon
|
||||
. = iconbro.appearance
|
||||
icon_cache[icon] = .
|
||||
|
||||
/atom/proc/build_appearance_list(old_overlays)
|
||||
// var/static/image/appearance_bro = new() // Moved to be superglobal due to BYOND insane init order stupidness.
|
||||
var/list/new_overlays = list()
|
||||
if (!islist(old_overlays))
|
||||
old_overlays = list(old_overlays)
|
||||
for (var/overlay in old_overlays)
|
||||
if(!overlay)
|
||||
continue
|
||||
if (istext(overlay))
|
||||
new_overlays += iconstate2appearance(icon, overlay)
|
||||
else if(isicon(overlay))
|
||||
new_overlays += icon2appearance(overlay)
|
||||
else
|
||||
if(isloc(overlay))
|
||||
var/atom/A = overlay
|
||||
if (A.flags & OVERLAY_QUEUED)
|
||||
COMPILE_OVERLAYS(A)
|
||||
appearance_bro.appearance = overlay //this works for images and atoms too!
|
||||
if(!ispath(overlay))
|
||||
var/image/I = overlay
|
||||
appearance_bro.dir = I.dir
|
||||
new_overlays += appearance_bro.appearance
|
||||
return new_overlays
|
||||
|
||||
#define NOT_QUEUED_ALREADY (!(flags & OVERLAY_QUEUED))
|
||||
#define QUEUE_FOR_COMPILE flags |= OVERLAY_QUEUED; SSoverlays.queue += src;
|
||||
|
||||
/**
|
||||
* Cut all of atom's normal overlays. Usually leaves "priority" overlays untouched.
|
||||
*
|
||||
* @param priority If true, also will cut priority overlays.
|
||||
*/
|
||||
/atom/proc/cut_overlays(priority = FALSE)
|
||||
var/list/cached_overlays = our_overlays
|
||||
var/list/cached_priority = priority_overlays
|
||||
|
||||
var/need_compile = FALSE
|
||||
|
||||
if(LAZYLEN(cached_overlays)) //don't queue empty lists, don't cut priority overlays
|
||||
cached_overlays.Cut() //clear regular overlays
|
||||
need_compile = TRUE
|
||||
|
||||
if(priority && LAZYLEN(cached_priority))
|
||||
cached_priority.Cut()
|
||||
need_compile = TRUE
|
||||
|
||||
if(NOT_QUEUED_ALREADY && need_compile)
|
||||
QUEUE_FOR_COMPILE
|
||||
|
||||
/**
|
||||
* Removes specific overlay(s) from the atom. Usually does not remove them from "priority" overlays.
|
||||
*
|
||||
* @param overlays The overlays to removed, type can be anything that is allowed for add_overlay().
|
||||
* @param priority If true, also will remove them from the "priority" overlays.
|
||||
*/
|
||||
/atom/proc/cut_overlay(list/overlays, priority)
|
||||
if(!overlays)
|
||||
return
|
||||
|
||||
overlays = build_appearance_list(overlays)
|
||||
|
||||
var/list/cached_overlays = our_overlays //sanic
|
||||
var/list/cached_priority = priority_overlays
|
||||
var/init_o_len = LAZYLEN(cached_overlays)
|
||||
var/init_p_len = LAZYLEN(cached_priority) //starter pokemon
|
||||
|
||||
LAZYREMOVE(cached_overlays, overlays)
|
||||
if(priority)
|
||||
LAZYREMOVE(cached_priority, overlays)
|
||||
|
||||
if(NOT_QUEUED_ALREADY && ((init_o_len != LAZYLEN(cached_overlays)) || (init_p_len != LAZYLEN(cached_priority))))
|
||||
QUEUE_FOR_COMPILE
|
||||
|
||||
/**
|
||||
* Adds specific overlay(s) to the atom.
|
||||
* It is designed so any of the types allowed to be added to /atom/overlays can be added here too. More details below.
|
||||
*
|
||||
* @param overlays The overlay(s) to add. These may be
|
||||
* - A string: In which case it is treated as an icon_state of the atom's icon.
|
||||
* - An icon: It is treated as an icon.
|
||||
* - An atom: Its own overlays are compiled and then it's appearance is added. (Meaning its current apperance is frozen).
|
||||
* - An image: Image's apperance is added (i.e. subsequently editing the image will not edit the overlay)
|
||||
* - A type path: Added to overlays as is. Does whatever it is BYOND does when you add paths to overlays.
|
||||
* - Or a list containing any of the above.
|
||||
* @param priority The overlays are added to the "priority" list istead of the normal one.
|
||||
*/
|
||||
/atom/proc/add_overlay(list/overlays, priority = FALSE)
|
||||
if(!overlays)
|
||||
return
|
||||
|
||||
overlays = build_appearance_list(overlays)
|
||||
|
||||
LAZYINITLIST(our_overlays) //always initialized after this point
|
||||
LAZYINITLIST(priority_overlays)
|
||||
|
||||
var/list/cached_overlays = our_overlays //sanic
|
||||
var/list/cached_priority = priority_overlays
|
||||
var/init_o_len = cached_overlays.len
|
||||
var/init_p_len = cached_priority.len //starter pokemon
|
||||
var/need_compile
|
||||
|
||||
if(priority)
|
||||
cached_priority += overlays //or in the image. Can we use [image] = image?
|
||||
need_compile = init_p_len != cached_priority.len
|
||||
else
|
||||
cached_overlays += overlays
|
||||
need_compile = init_o_len != cached_overlays.len
|
||||
|
||||
if(NOT_QUEUED_ALREADY && need_compile) //have we caught more pokemon?
|
||||
QUEUE_FOR_COMPILE
|
||||
|
||||
/**
|
||||
* Copy the overlays from another atom, either replacing all of ours or appending to our existing overlays.
|
||||
* Note: This copies only the normal overlays, not the "priority" overlays.
|
||||
*
|
||||
* @param other The atom to copy overlays from.
|
||||
* @param cut_old If true, all of our overlays will be *replaced* by the other's. If other is null, that means cutting all ours.
|
||||
*/
|
||||
/atom/proc/copy_overlays(atom/other, cut_old) //copys our_overlays from another atom
|
||||
if(!other)
|
||||
if(cut_old)
|
||||
cut_overlays()
|
||||
return
|
||||
|
||||
var/list/cached_other = other.our_overlays
|
||||
if(cached_other)
|
||||
if(cut_old || !LAZYLEN(our_overlays))
|
||||
our_overlays = cached_other.Copy()
|
||||
else
|
||||
our_overlays |= cached_other
|
||||
if(NOT_QUEUED_ALREADY)
|
||||
QUEUE_FOR_COMPILE
|
||||
else if(cut_old)
|
||||
cut_overlays()
|
||||
|
||||
#undef NOT_QUEUED_ALREADY
|
||||
#undef QUEUE_FOR_COMPILE
|
||||
|
||||
//TODO: Better solution for these?
|
||||
/image/proc/add_overlay(x)
|
||||
overlays += x
|
||||
|
||||
/image/proc/cut_overlay(x)
|
||||
overlays -= x
|
||||
|
||||
/image/proc/cut_overlays(x)
|
||||
overlays.Cut()
|
||||
|
||||
/image/proc/copy_overlays(atom/other, cut_old)
|
||||
if(!other)
|
||||
if(cut_old)
|
||||
cut_overlays()
|
||||
return
|
||||
|
||||
var/list/cached_other = other.our_overlays
|
||||
if(cached_other)
|
||||
if(cut_old || !overlays.len)
|
||||
overlays = cached_other.Copy()
|
||||
else
|
||||
overlays |= cached_other
|
||||
else if(cut_old)
|
||||
cut_overlays()
|
||||
Reference in New Issue
Block a user