Skip to content

Commit

Permalink
Merge remote-tracking branch 'CMSS13/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Oct 19, 2023
2 parents 24e0726 + dba4afd commit 64b11c9
Show file tree
Hide file tree
Showing 66 changed files with 6,274 additions and 6,229 deletions.
1 change: 0 additions & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@
#define SS_INIT_MINIMAP -34
#define SS_INIT_STATPANELS -98
#define SS_INIT_CHAT -100 //Should be last to ensure chat remains smooth during init.
#define SS_INIT_EARLYRUNTIMES -500 // Post-init notifier

// Subsystem fire priority, from lowest to highest priority
// If the subsystem isn't listed here it's either DEFAULT or PROCESS (if it's a processing subsystem child)
Expand Down
81 changes: 76 additions & 5 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -876,22 +876,93 @@ world
return image_to_center

//For creating consistent icons for human looking simple animals
/proc/get_flat_human_icon(icon_id, datum/equipment_preset/preset, datum/preferences/prefs, dummy_key, showDirs = GLOB.cardinals, outfit_override)
/proc/get_flat_human_icon(icon_id, equipment_preset_dresscode, datum/preferences/prefs, dummy_key, showDirs = GLOB.cardinals, outfit_override)
var/static/list/humanoid_icon_cache = list()
if(!icon_id || !humanoid_icon_cache[icon_id])
var/mob/living/carbon/human/dummy/body = generate_or_wait_for_human_dummy(dummy_key)

if(prefs)
prefs.copy_all_to(body)
arm_equipment(body, preset)
body.update_body()
body.update_hair()

// Assumption: Is a list
if(outfit_override)
for(var/obj/item/cur_item as anything in outfit_override)
body.equip_to_appropriate_slot(cur_item)

// Assumption: Is a string or path
if(equipment_preset_dresscode)
arm_equipment(body, equipment_preset_dresscode)

var/icon/out_icon = icon('icons/effects/effects.dmi', "nothing")
for(var/D in showDirs)
body.setDir(D)
for(var/dir in showDirs)
body.setDir(dir)
var/icon/partial = getFlatIcon(body)
out_icon.Insert(partial, dir = D)
out_icon.Insert(partial, dir = dir)

humanoid_icon_cache[icon_id] = out_icon
dummy_key ? unset_busy_human_dummy(dummy_key) : qdel(body)
return out_icon
else
return humanoid_icon_cache[icon_id]

/proc/get_flat_human_copy_icon(mob/living/carbon/human/original, equipment_preset_dresscode, showDirs = GLOB.cardinals, outfit_override)
var/mob/living/carbon/human/dummy/body = generate_or_wait_for_human_dummy(null)

if(original)
// From /datum/preferences/proc/copy_appearance_to
body.age = original.age
body.gender = original.gender
body.ethnicity = original.ethnicity
body.body_type = original.body_type

body.r_eyes = original.r_eyes
body.g_eyes = original.g_eyes
body.b_eyes = original.b_eyes

body.r_hair = original.r_hair
body.g_hair = original.g_hair
body.b_hair = original.b_hair

body.r_gradient = original.r_gradient
body.g_gradient = original.g_gradient
body.b_gradient = original.b_gradient
body.grad_style = original.grad_style

body.r_facial = original.r_facial
body.g_facial = original.g_facial
body.b_facial = original.b_facial

body.r_skin = original.r_skin
body.g_skin = original.g_skin
body.b_skin = original.b_skin

body.h_style = original.h_style
body.f_style = original.f_style

body.underwear = original.underwear
body.undershirt = original.undershirt

body.update_body()
body.update_hair()

// Assumption: Is a list
if(outfit_override)
for(var/obj/item/cur_item as anything in outfit_override)
body.equip_to_appropriate_slot(cur_item)

// Assumption: Is a string or path
if(equipment_preset_dresscode)
arm_equipment(body, equipment_preset_dresscode)

var/icon/out_icon = icon('icons/effects/effects.dmi', "nothing")
for(var/dir in showDirs)
body.setDir(dir)
var/icon/partial = getFlatIcon(body)
out_icon.Insert(partial, dir = dir)

// log_debug("get_flat_human_copy_icon called on ref=[REF(original)], instance=[original], type=[original.type], with [length(original.overlays)] overlays reduced to [length(body.overlays)] overlays")

qdel(body)
return out_icon
30 changes: 18 additions & 12 deletions code/controllers/subsystem/inactivity.dm
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
#define INACTIVITY_KICK 6000 //10 minutes in ticks (approx.)
#define INACTIVITY_KICK 10 MINUTES

SUBSYSTEM_DEF(inactivity)
name = "Inactivity"
wait = INACTIVITY_KICK
wait = 1 MINUTES
flags = SS_NO_INIT | SS_BACKGROUND
priority = SS_PRIORITY_INACTIVITY
runlevels = RUNLEVELS_DEFAULT|RUNLEVEL_LOBBY

/datum/controller/subsystem/inactivity/fire(resumed = FALSE)
if (CONFIG_GET(flag/kick_inactive))
for(var/i in GLOB.clients)
var/client/C = i
if(C.admin_holder && C.admin_holder.rights & R_ADMIN) //Skip admins.
continue
if (C.is_afk(INACTIVITY_KICK))
if (!istype(C.mob, /mob/dead))
log_access("AFK: [key_name(C)]")
to_chat(C, SPAN_WARNING("You have been inactive for more than 10 minutes and have been disconnected."))
qdel(C)
if(list_clear_nulls(GLOB.clients))
debug_log("Removed nulls from GLOB.clients!")
if(list_clear_nulls(GLOB.player_list))
debug_log("Removed nulls from GLOB.player_list!")

if (!CONFIG_GET(flag/kick_inactive))
return

for(var/client/current as anything in GLOB.clients)
if(current.admin_holder && current.admin_holder.rights & R_ADMIN) //Skip admins.
continue
if(current.is_afk(INACTIVITY_KICK))
if(!istype(current.mob, /mob/dead))
log_access("AFK: [key_name(current)]")
to_chat(current, SPAN_WARNING("You have been inactive for more than [INACTIVITY_KICK / 600] minutes and have been disconnected."))
qdel(current)
14 changes: 0 additions & 14 deletions code/controllers/subsystem/init/earlyruntimes.dm

This file was deleted.

38 changes: 33 additions & 5 deletions code/controllers/subsystem/statpanel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ SUBSYSTEM_DEF(statpanels)
var/client/target = currentrun[length(currentrun)]
currentrun.len--

if(!target)
continue

if(!target.stat_panel.is_ready())
continue

Expand Down Expand Up @@ -313,14 +316,39 @@ SUBSYSTEM_DEF(statpanels)
for(index in 1 to length(to_make))
var/atom/thing = to_make[index]

// var/start_time = REALTIMEOFDAY
var/generated_string
/* We're cheap and won't render all overlays. It's expensive and updates with onmob changes!
if(ismob(thing) || length(thing.overlays) > 2)
generated_string = costly_icon2html(thing, parent, sourceonly=TRUE)
// We're cheap and won't render all overlays. It's expensive and updates with onmob changes!
//if(ismob(thing) || length(thing.overlays) > 2)
//generated_string = costly_icon2html(thing, parent, sourceonly=TRUE)
if(ishuman(thing))
var/mob/living/carbon/human/human_thing = thing
var/icon

// Ensure they have their armor since its going to be the majority of their appearance
var/list/armor = list()
var/obj/item/uniform = human_thing.get_item_by_slot(WEAR_BODY)
if(uniform)
armor += new uniform.type
var/obj/item/hat = human_thing.get_item_by_slot(WEAR_HEAD)
if(hat)
armor += new hat.type
var/obj/item/suit = human_thing.get_item_by_slot(WEAR_JACKET)
if(suit)
armor += new suit.type
var/obj/item/gloves = human_thing.get_item_by_slot(WEAR_HANDS)
if(gloves)
armor += new gloves.type
var/obj/item/shoes = human_thing.get_item_by_slot(WEAR_FEET)
if(shoes)
armor += new shoes.type

// If we don't succeed making a flat human icon below, allowing the human to pass into icon2html will throw a bad icon operation because of a workaround in icon2html for humans...
icon = get_flat_human_copy_icon(human_thing, showDirs = list(SOUTH), outfit_override = armor)
generated_string = icon2html(icon, parent, sourceonly=TRUE)
// log_debug("object_window_info called on ref=[REF(thing)], instance=[thing], type=[thing.type], finished in [(REALTIMEOFDAY-start_time) / 10]s")
else
generated_string = icon2html(thing, parent, sourceonly=TRUE)
*/
generated_string = icon2html(thing, parent, sourceonly=TRUE)

newly_seen[thing] = generated_string
if(TICK_CHECK)
Expand Down
Loading

0 comments on commit 64b11c9

Please sign in to comment.