mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 18:11:47 +00:00
Let's cull some more lists (#40246)
* memes * autolathe, also more debug info * more stuff, archdrops is big * remove archdrops, test statelists * mineralspawnchancelist * woops
This commit is contained in:
committed by
AnturK
parent
ec15d16305
commit
9897bdc248
43
code/__HELPERS/typelists.dm
Normal file
43
code/__HELPERS/typelists.dm
Normal file
@@ -0,0 +1,43 @@
|
||||
GLOBAL_LIST_EMPTY(typelists)
|
||||
|
||||
#ifndef TESTING
|
||||
|
||||
/datum/proc/typelist(key, list/values = list())
|
||||
var/list/mytypelist = GLOB.typelists[type] || (GLOB.typelists[type] = list())
|
||||
return mytypelist[key] || (mytypelist[key] = values.Copy())
|
||||
|
||||
#else
|
||||
// mostly the same code as above, just more verbose, slower and has tallying for saved lists
|
||||
/datum/proc/typelist(key, list/values)
|
||||
if (!values)
|
||||
values = list()
|
||||
GLOB.typelistkeys |= key
|
||||
if (GLOB.typelists[type])
|
||||
if (GLOB.typelists[type][key])
|
||||
GLOB.typelists[type]["[key]-saved"]++
|
||||
return GLOB.typelists[type][key]
|
||||
else
|
||||
GLOB.typelists[type][key] = values.Copy()
|
||||
else
|
||||
GLOB.typelists[type] = list()
|
||||
GLOB.typelists[type][key] = values.Copy()
|
||||
return GLOB.typelists[type][key]
|
||||
|
||||
GLOBAL_LIST_EMPTY(typelistkeys)
|
||||
|
||||
/proc/tallytypelistsavings()
|
||||
var/savings = list()
|
||||
var/saveditems = list()
|
||||
for (var/key in GLOB.typelistkeys)
|
||||
savings[key] = 0
|
||||
saveditems[key] = 0
|
||||
|
||||
for (var/type in GLOB.typelists)
|
||||
for (var/saving in savings)
|
||||
if (GLOB.typelists[type]["[saving]-saved"])
|
||||
savings[saving] += GLOB.typelists[type]["[saving]-saved"]
|
||||
saveditems[saving] += (GLOB.typelists[type]["[saving]-saved"] * length(GLOB.typelists[type][saving]))
|
||||
|
||||
for (var/saving in savings)
|
||||
to_chat(world, "Savings for [saving]: [savings[saving]] lists, [saveditems[saving]] items")
|
||||
#endif
|
||||
@@ -74,6 +74,9 @@
|
||||
var/turf/T = loc
|
||||
T.has_opaque_atom = TRUE // No need to recalculate it in this case, it's guaranteed to be on afterwards anyways.
|
||||
|
||||
if (canSmoothWith)
|
||||
canSmoothWith = typelist("canSmoothWith", canSmoothWith)
|
||||
|
||||
ComponentInitialize()
|
||||
|
||||
return INITIALIZE_HINT_NORMAL
|
||||
@@ -693,4 +696,4 @@ Proc for attack log creation, because really why not
|
||||
|
||||
/atom/movable/proc/get_filter(name)
|
||||
if(filter_data && filter_data[name])
|
||||
return filters[filter_data.Find(name)]
|
||||
return filters[filter_data.Find(name)]
|
||||
|
||||
@@ -201,6 +201,7 @@
|
||||
else
|
||||
for(var/i=1, i<=multiplier, i++)
|
||||
var/obj/item/new_item = new being_built.build_path(A)
|
||||
new_item.materials = new_item.materials.Copy()
|
||||
for(var/mat in materials_used)
|
||||
new_item.materials[mat] = materials_used[mat] / multiplier
|
||||
new_item.autolathe_crafted(src)
|
||||
|
||||
@@ -108,8 +108,12 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
var/list/juice_results //A reagent list containing blah blah... but when JUICED in a grinder!
|
||||
|
||||
/obj/item/Initialize()
|
||||
if (!materials)
|
||||
materials = list()
|
||||
|
||||
materials = typelist("materials", materials)
|
||||
|
||||
if (attack_verb)
|
||||
attack_verb = typelist("attack_verb", attack_verb)
|
||||
|
||||
. = ..()
|
||||
for(var/path in actions_types)
|
||||
new path(src)
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
tiled_dirt = TRUE
|
||||
|
||||
/turf/open/floor/Initialize(mapload)
|
||||
if (!broken_states)
|
||||
broken_states = list("damaged1", "damaged2", "damaged3", "damaged4", "damaged5")
|
||||
if (!burnt_states)
|
||||
burnt_states = list()
|
||||
|
||||
broken_states = typelist("broken_states", broken_states)
|
||||
burnt_states = typelist("burnt_states", burnt_states)
|
||||
if(!broken && broken_states && (icon_state in broken_states))
|
||||
broken = TRUE
|
||||
if(!burnt && burnt_states && (icon_state in burnt_states))
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
if(!broken_states)
|
||||
broken_states = list("[initial(icon_state)]_dam")
|
||||
. = ..()
|
||||
if (!icons)
|
||||
icons = list()
|
||||
icons = typelist("icons", icons)
|
||||
|
||||
|
||||
/turf/open/floor/mineral/update_icon()
|
||||
|
||||
@@ -131,17 +131,17 @@
|
||||
T.ChangeTurf(type)
|
||||
|
||||
/turf/closed/mineral/random
|
||||
var/mineralSpawnChanceList
|
||||
var/list/mineralSpawnChanceList = list(/turf/closed/mineral/uranium = 5, /turf/closed/mineral/diamond = 1, /turf/closed/mineral/gold = 10,
|
||||
/turf/closed/mineral/silver = 12, /turf/closed/mineral/plasma = 20, /turf/closed/mineral/iron = 40, /turf/closed/mineral/titanium = 11,
|
||||
/turf/closed/mineral/gibtonite = 4, /turf/open/floor/plating/asteroid/airless/cave = 2, /turf/closed/mineral/bscrystal = 1)
|
||||
//Currently, Adamantine won't spawn as it has no uses. -Durandan
|
||||
var/mineralChance = 13
|
||||
var/display_icon_state = "rock"
|
||||
|
||||
/turf/closed/mineral/random/Initialize()
|
||||
if (!mineralSpawnChanceList)
|
||||
mineralSpawnChanceList = list(
|
||||
/turf/closed/mineral/uranium = 5, /turf/closed/mineral/diamond = 1, /turf/closed/mineral/gold = 10,
|
||||
/turf/closed/mineral/silver = 12, /turf/closed/mineral/plasma = 20, /turf/closed/mineral/iron = 40, /turf/closed/mineral/titanium = 11,
|
||||
/turf/closed/mineral/gibtonite = 4, /turf/open/floor/plating/asteroid/airless/cave = 2, /turf/closed/mineral/bscrystal = 1)
|
||||
|
||||
mineralSpawnChanceList = typelist("mineralSpawnChanceList", mineralSpawnChanceList)
|
||||
|
||||
if (display_icon_state)
|
||||
icon_state = display_icon_state
|
||||
. = ..()
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
#include "code\__HELPERS\text.dm"
|
||||
#include "code\__HELPERS\time.dm"
|
||||
#include "code\__HELPERS\type2type.dm"
|
||||
#include "code\__HELPERS\typelists.dm"
|
||||
#include "code\__HELPERS\unsorted.dm"
|
||||
#include "code\__HELPERS\view.dm"
|
||||
#include "code\__HELPERS\sorts\__main.dm"
|
||||
|
||||
Reference in New Issue
Block a user