mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
Merge branch 'master' of https://github.com/tgstation/tgstation into upstream-25-04a
This commit is contained in:
@@ -13,6 +13,8 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
|
||||
var/list/fish_properties
|
||||
///A cache of fish that can be caught by each type of fishing lure
|
||||
var/list/lure_catchables
|
||||
///A list of fish types with list of turfs where they can happily hop around without dying as assoc value
|
||||
var/list/fish_safe_turfs_by_type = list()
|
||||
|
||||
/datum/controller/subsystem/processing/fishing/Initialize()
|
||||
..()
|
||||
@@ -102,4 +104,19 @@ PROCESSING_SUBSYSTEM_DEF(fishing)
|
||||
|
||||
QDEL_LIST(spawned_fish)
|
||||
|
||||
//Populate the list of safe turfs for several fishes
|
||||
for(var/source_path in GLOB.preset_fish_sources)
|
||||
var/datum/fish_source/source = GLOB.preset_fish_sources[source_path]
|
||||
if(!length(source.associated_safe_turfs))
|
||||
continue
|
||||
for(var/fish_path in source.fish_table)
|
||||
if(!istype(fish_path, /obj/item/fish))
|
||||
continue
|
||||
LAZYOR(fish_safe_turfs_by_type[fish_path], source.associated_safe_turfs)
|
||||
//If a subtype doesn't have set safe turfs, it'll inherit them from the parent type.
|
||||
for(var/fish_type as anything in fish_safe_turfs_by_type)
|
||||
for(var/fish_subtype in subtypesof(fish_type))
|
||||
if(!length(fish_safe_turfs_by_type[fish_subtype]))
|
||||
fish_safe_turfs_by_type[fish_subtype] = fish_safe_turfs_by_type[fish_type]
|
||||
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/// Disable to use builtin DM-based generation.
|
||||
/// IconForge is 250x times faster but requires storing the icons in tmp/ and may result in higher asset transport.
|
||||
/// Note that the builtin GAGS editor still uses the 'legacy' generation to allow for debugging.
|
||||
/// IconForge also does not support the color matrix layer type or the 'or' blend_mode, however both are currently unused.
|
||||
#define USE_RUSTG_ICONFORGE_GAGS
|
||||
|
||||
PROCESSING_SUBSYSTEM_DEF(greyscale)
|
||||
name = "Greyscale"
|
||||
flags = SS_BACKGROUND
|
||||
@@ -6,6 +12,10 @@ PROCESSING_SUBSYSTEM_DEF(greyscale)
|
||||
|
||||
var/list/datum/greyscale_config/configurations = list()
|
||||
var/list/datum/greyscale_layer/layer_types = list()
|
||||
#ifdef USE_RUSTG_ICONFORGE_GAGS
|
||||
/// Cache containing a list of [UID (config path + colors)] -> [DMI file / RSC object] in the tmp directory from iconforge
|
||||
var/list/gags_cache = list()
|
||||
#endif
|
||||
|
||||
/datum/controller/subsystem/processing/greyscale/Initialize()
|
||||
for(var/datum/greyscale_layer/fake_type as anything in subtypesof(/datum/greyscale_layer))
|
||||
@@ -21,14 +31,35 @@ PROCESSING_SUBSYSTEM_DEF(greyscale)
|
||||
var/datum/greyscale_config/config = configurations[greyscale_type]
|
||||
config.Refresh()
|
||||
|
||||
#ifdef USE_RUSTG_ICONFORGE_GAGS
|
||||
var/list/job_ids = list()
|
||||
#endif
|
||||
|
||||
// This final verification step is for things that need other greyscale configurations to be finished loading
|
||||
for(var/greyscale_type as anything in configurations)
|
||||
CHECK_TICK
|
||||
var/datum/greyscale_config/config = configurations[greyscale_type]
|
||||
config.CrossVerify()
|
||||
#ifdef USE_RUSTG_ICONFORGE_GAGS
|
||||
job_ids += rustg_iconforge_load_gags_config_async(greyscale_type, config.raw_json_string, config.string_icon_file)
|
||||
|
||||
UNTIL(jobs_completed(job_ids))
|
||||
#endif
|
||||
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
#ifdef USE_RUSTG_ICONFORGE_GAGS
|
||||
/datum/controller/subsystem/processing/greyscale/proc/jobs_completed(list/job_ids)
|
||||
for(var/job in job_ids)
|
||||
var/result = rustg_iconforge_check(job)
|
||||
if(result == RUSTG_JOB_NO_RESULTS_YET)
|
||||
return FALSE
|
||||
if(result != "OK")
|
||||
stack_trace("Error during rustg_iconforge_load_gags_config job: [result]")
|
||||
job_ids -= job
|
||||
return TRUE
|
||||
#endif
|
||||
|
||||
/datum/controller/subsystem/processing/greyscale/proc/RefreshConfigsFromFile()
|
||||
for(var/i in configurations)
|
||||
configurations[i].Refresh(TRUE)
|
||||
@@ -36,12 +67,40 @@ PROCESSING_SUBSYSTEM_DEF(greyscale)
|
||||
/datum/controller/subsystem/processing/greyscale/proc/GetColoredIconByType(type, list/colors)
|
||||
if(!ispath(type, /datum/greyscale_config))
|
||||
CRASH("An invalid greyscale configuration was given to `GetColoredIconByType()`: [type]")
|
||||
if(!initialized)
|
||||
CRASH("GetColoredIconByType() called before greyscale subsystem initialized!")
|
||||
type = "[type]"
|
||||
if(istype(colors)) // It's the color list format
|
||||
colors = colors.Join()
|
||||
else if(!istext(colors))
|
||||
CRASH("Invalid colors were given to `GetColoredIconByType()`: [colors]")
|
||||
#ifdef USE_RUSTG_ICONFORGE_GAGS
|
||||
var/uid = "[replacetext(replacetext(type, "/datum/greyscale_config/", ""), "/", "-")]-[colors]"
|
||||
var/cached_file = gags_cache[uid]
|
||||
if(cached_file)
|
||||
return cached_file
|
||||
var/output_path = "tmp/gags/gags-[uid].dmi"
|
||||
var/iconforge_output = rustg_iconforge_gags(type, colors, output_path)
|
||||
// Handle errors from IconForge
|
||||
if(iconforge_output != "OK")
|
||||
CRASH(iconforge_output)
|
||||
// We'll just explicitly do fcopy_rsc here, so the game doesn't have to do it again later from the cached file.
|
||||
var/rsc_gags_icon = fcopy_rsc(file(output_path))
|
||||
gags_cache[uid] = rsc_gags_icon
|
||||
return rsc_gags_icon
|
||||
#else
|
||||
return configurations[type].Generate(colors)
|
||||
#endif
|
||||
|
||||
/datum/controller/subsystem/processing/greyscale/proc/GetColoredIconByTypeUniversalIcon(type, list/colors, target_icon_state)
|
||||
if(!ispath(type, /datum/greyscale_config))
|
||||
CRASH("An invalid greyscale configuration was given to `GetColoredIconByTypeUniversalIcon()`: [type]")
|
||||
type = "[type]"
|
||||
if(istype(colors)) // It's the color list format
|
||||
colors = colors.Join()
|
||||
else if(!istext(colors))
|
||||
CRASH("Invalid colors were given to `GetColoredIconByTypeUniversalIcon()`: [colors]")
|
||||
return configurations[type].GenerateUniversalIcon(colors, target_icon_state)
|
||||
|
||||
/datum/controller/subsystem/processing/greyscale/proc/GetColoredIconByTypeUniversalIcon(type, list/colors, target_icon_state)
|
||||
if(!ispath(type, /datum/greyscale_config))
|
||||
@@ -58,3 +117,5 @@ PROCESSING_SUBSYSTEM_DEF(greyscale)
|
||||
var/list/split_colors = splittext(color_string, "#")
|
||||
for(var/color in 2 to length(split_colors))
|
||||
. += "#[split_colors[color]]"
|
||||
|
||||
#undef USE_RUSTG_ICONFORGE_GAGS
|
||||
|
||||
Reference in New Issue
Block a user