Merge branch 'master' into runtime-fix-2

This commit is contained in:
farie82
2020-04-19 00:01:37 +02:00
committed by GitHub
234 changed files with 789 additions and 656 deletions
+13 -1
View File
@@ -179,7 +179,7 @@
var/title = name
if(can_fire)
title = "\[[state_letter()]][title]"
title = "[state_colour()]\[[state_letter()]][title]</font>"
stat(title, statclick.update(msg))
@@ -196,6 +196,18 @@
if(SS_IDLE)
. = " "
/datum/controller/subsystem/proc/state_colour()
switch(state)
if(SS_RUNNING) // If its actively processing, colour it green
. = "<font color='#32a852'>"
if(SS_QUEUED) // If its in the running queue, but delayed, colour it orange
. = "<font color='#fcba03'>"
if(SS_PAUSED, SS_PAUSING) // If its being paused due to lag, colour it red
. = "<font color='#eb4034'>"
if(SS_SLEEPING) // If fire() slept, colour it blue
. = "<font color='#4287f5'>"
if(SS_IDLE) // Leave it default if the SS is idle
. = "<font>"
//could be used to postpone a costly subsystem for (default one) var/cycles, cycles
//for instance, during cpu intensive operations like explosions
/datum/controller/subsystem/proc/postpone(cycles = 1)
+2 -2
View File
@@ -36,7 +36,7 @@ SUBSYSTEM_DEF(events)
E.process()
for(var/i = EVENT_LEVEL_MUNDANE to EVENT_LEVEL_MAJOR)
var/list/datum/event_container/EC = event_containers[i]
var/datum/event_container/EC = event_containers[i]
EC.process()
/datum/controller/subsystem/events/proc/event_complete(var/datum/event/E)
@@ -65,7 +65,7 @@ SUBSYSTEM_DEF(events)
log_debug("Event '[EM.name]' has completed at [station_time_timestamp()].")
/datum/controller/subsystem/events/proc/delay_events(var/severity, var/delay)
var/list/datum/event_container/EC = event_containers[severity]
var/datum/event_container/EC = event_containers[severity]
EC.next_event_time += delay
/datum/controller/subsystem/events/proc/Interact(var/mob/living/user)
+7 -7
View File
@@ -10,7 +10,7 @@ SUBSYSTEM_DEF(jobs)
var/list/type_occupations = list() //Dict of all jobs, keys are types
var/list/prioritized_jobs = list() // List of jobs set to priority by HoP/Captain
var/list/id_change_records = list() // List of all job transfer records
var/list/id_change_counter = 1
var/id_change_counter = 1
//Players who need jobs
var/list/unassigned = list()
//Debug info
@@ -39,8 +39,6 @@ SUBSYSTEM_DEF(jobs)
var/datum/job/job = new J()
if(!job)
continue
if(!job.faction in faction)
continue
occupations += job
name_occupations[job.title] = job
type_occupations[J] = job
@@ -138,7 +136,7 @@ SUBSYSTEM_DEF(jobs)
if(flag && !(flag in player.client.prefs.be_special))
Debug("FOC flag failed, Player: [player], Flag: [flag], ")
continue
if(player.mind && job.title in player.mind.restricted_roles)
if(player.mind && (job.title in player.mind.restricted_roles))
Debug("FOC incompatbile with antagonist role, Player: [player]")
continue
if(player.client.prefs.GetJobDepartment(job, level) & job.flag)
@@ -180,7 +178,7 @@ SUBSYSTEM_DEF(jobs)
Debug("GRJ player has disability rendering them ineligible for job, Player: [player]")
continue
if(player.mind && job.title in player.mind.restricted_roles)
if(player.mind && (job.title in player.mind.restricted_roles))
Debug("GRJ incompatible with antagonist role, Player: [player], Job: [job.title]")
continue
@@ -357,7 +355,7 @@ SUBSYSTEM_DEF(jobs)
Debug("DO player has disability rendering them ineligible for job, Player: [player], Job:[job.title]")
continue
if(player.mind && job.title in player.mind.restricted_roles)
if(player.mind && (job.title in player.mind.restricted_roles))
Debug("DO incompatible with antagonist role, Player: [player], Job:[job.title]")
continue
@@ -622,7 +620,9 @@ SUBSYSTEM_DEF(jobs)
if(tgtcard.assignment && tgtcard.assignment == job.title)
jobs_to_formats[job.title] = "disabled" // the job they already have is pre-selected
else if(!job.would_accept_job_transfer_from_player(M))
jobs_to_formats[job.title] = "linkDiscourage" // karma jobs they don't have available are discouraged
jobs_to_formats[job.title] = "linkDiscourage" // jobs which are karma-locked and not unlocked for this player are discouraged
else if((job.title in GLOB.command_positions) && istype(M) && M.client && job.available_in_playtime(M.client))
jobs_to_formats[job.title] = "linkDiscourage" // command jobs which are playtime-locked and not unlocked for this player are discouraged
else if(job.total_positions && !job.current_positions && job.title != "Civilian")
jobs_to_formats[job.title] = "linkEncourage" // jobs with nobody doing them at all are encouraged
else if(job.total_positions >= 0 && job.current_positions >= job.total_positions)
+85
View File
@@ -32,5 +32,90 @@ SUBSYSTEM_DEF(mapping)
return ..()
/datum/controller/subsystem/mapping/proc/seedRuins(list/z_levels = null, budget = 0, whitelist = /area/space, list/potentialRuins)
if(!z_levels || !z_levels.len)
WARNING("No Z levels provided - Not generating ruins")
return
for(var/zl in z_levels)
var/turf/T = locate(1, 1, zl)
if(!T)
WARNING("Z level [zl] does not exist - Not generating ruins")
return
var/list/ruins = potentialRuins.Copy()
var/list/forced_ruins = list() //These go first on the z level associated (same random one by default)
var/list/ruins_availible = list() //we can try these in the current pass
var/forced_z //If set we won't pick z level and use this one instead.
//Set up the starting ruin list
for(var/key in ruins)
var/datum/map_template/ruin/R = ruins[key]
if(R.cost > budget) //Why would you do that
continue
if(R.always_place)
forced_ruins[R] = -1
if(R.unpickable)
continue
ruins_availible[R] = R.placement_weight
while(budget > 0 && (ruins_availible.len || forced_ruins.len))
var/datum/map_template/ruin/current_pick
var/forced = FALSE
if(forced_ruins.len) //We have something we need to load right now, so just pick it
for(var/ruin in forced_ruins)
current_pick = ruin
if(forced_ruins[ruin] > 0) //Load into designated z
forced_z = forced_ruins[ruin]
forced = TRUE
break
else //Otherwise just pick random one
current_pick = pickweight(ruins_availible)
var/placement_tries = PLACEMENT_TRIES
var/failed_to_place = TRUE
var/z_placed = 0
while(placement_tries > 0)
placement_tries--
z_placed = pick(z_levels)
if(!current_pick.try_to_place(forced_z ? forced_z : z_placed,whitelist))
continue
else
failed_to_place = FALSE
break
//That's done remove from priority even if it failed
if(forced)
//TODO : handle forced ruins with multiple variants
forced_ruins -= current_pick
forced = FALSE
if(failed_to_place)
for(var/datum/map_template/ruin/R in ruins_availible)
if(R.id == current_pick.id)
ruins_availible -= R
log_world("Failed to place [current_pick.name] ruin.")
else
budget -= current_pick.cost
if(!current_pick.allow_duplicates)
for(var/datum/map_template/ruin/R in ruins_availible)
if(R.id == current_pick.id)
ruins_availible -= R
if(current_pick.never_spawn_with)
for(var/blacklisted_type in current_pick.never_spawn_with)
for(var/possible_exclusion in ruins_availible)
if(istype(possible_exclusion,blacklisted_type))
ruins_availible -= possible_exclusion
forced_z = 0
//Update the availible list
for(var/datum/map_template/ruin/R in ruins_availible)
if(R.cost > budget)
ruins_availible -= R
log_world("Ruin loader finished with [budget] left to spend.")
/datum/controller/subsystem/mapping/Recover()
flags |= SS_NO_INIT
+2 -1
View File
@@ -223,11 +223,12 @@ SUBSYSTEM_DEF(shuttle)
return 0 //dock successful
/datum/controller/subsystem/shuttle/proc/moveShuttle(shuttleId, dockId, timed)
/datum/controller/subsystem/shuttle/proc/moveShuttle(shuttleId, dockId, timed, mob/user)
var/obj/docking_port/mobile/M = getShuttle(shuttleId)
var/obj/docking_port/stationary/D = getDock(dockId)
if(!M)
return 1
M.last_caller = user // Save the caller of the shuttle for later logging
if(timed)
if(M.request(D))
return 2
+11 -2
View File
@@ -1,19 +1,28 @@
SUBSYSTEM_DEF(sun)
name = "Sun"
wait = 600
flags = SS_NO_TICK_CHECK|SS_NO_INIT
flags = SS_NO_TICK_CHECK
init_order = INIT_ORDER_SUN
var/angle
var/dx
var/dy
var/rate
var/list/solars = list()
/datum/controller/subsystem/sun/PreInit()
/datum/controller/subsystem/sun/Initialize(start_timeofday)
// Lets work out an angle for the "sun" to rotate around the station
angle = rand (0,360) // the station position to the sun is randomised at round start
rate = rand(50,200)/100 // 50% - 200% of standard rotation
if(prob(50)) // same chance to rotate clockwise than counter-clockwise
rate = -rate
// Solar consoles need to load after machines init, so this handles that
for(var/obj/machinery/power/solar_control/SC in solars)
SC.setup()
return ..()
/datum/controller/subsystem/sun/stat_entry(msg)
..("P:[solars.len]")