mob ai: iff factions, small turbolift/maploader fix (#6702)

replaces old faction system with one that supports lists
This commit is contained in:
silicons
2024-09-06 13:23:38 -06:00
committed by GitHub
parent 6dbb18ede6
commit 6b8a74e682
160 changed files with 685 additions and 466 deletions
+2 -2
View File
@@ -129,8 +129,8 @@
for(var/i in 1 to length(levels))
if(ispath(levels[i]))
var/datum/map_level/level_path = levels[i]
var/datum/map_level/level_instance = new level_path
level_instance.hardcoded = TRUE
var/datum/map_level/level_instance = new level_path(src)
level_instance.hardcoded = TRUE // todo: map can just also not be hardcoded
levels[i] = level_instance
if(levels_match_mangling_id)
level_instance.mangling_id = mangling_id || id
+54 -28
View File
@@ -45,23 +45,41 @@
var/base_turf = /turf/space
/// base area typepath for this level
var/base_area = /area/space
/// id of north zlevel - overrides linkage if set. can be set to path, autoconverts to id on new.
/// can also be set to instance - used for structs.
/// id of north zlevel - overrides linkage if set.
///
/// * can also be set to path
/// * can also be set to instance - used for structs
/// * do not manually set it to levelpath::id, map levels generate ids dynamically!
var/link_north
/// id of south zlevel - overrides linkage if set. can be set to path, autoconverts to id on new.
/// can also be set to instance - used for structs.
/// id of south zlevel - overrides linkage if set.
///
/// * can also be set to path
/// * can also be set to instance - used for structs
/// * do not manually set it to levelpath::id, map levels generate ids dynamically! can also be set to instance - used for structs.
var/link_south
/// id of west zlevel - overrides linkage if set. can be set to path, autoconverts to id on new.
/// can also be set to instance - used for structs.
/// id of west zlevel - overrides linkage if set.
///
/// * can also be set to path
/// * can also be set to instance - used for structs
/// * do not manually set it to levelpath::id, map levels generate ids dynamically! can also be set to instance - used for structs.
var/link_west
/// id of east zlevel - overrides linkage if set. can be set to path, autoconverts to id on new.
/// can also be set to instance - used for structs.
/// id of east zlevel - overrides linkage if set.
///
/// * can also be set to path
/// * can also be set to instance - used for structs
/// * do not manually set it to levelpath::id, map levels generate ids dynamically! can also be set to instance - used for structs.
var/link_east
/// id of below zlevel - overrides linkage if set. can be set to path, autoconverts to id on new.
/// can also be set to instance - used for structs.
/// id of below zlevel - overrides linkage if set.
///
/// * can also be set to path
/// * can also be set to instance - used for structs
/// * do not manually set it to levelpath::id, map levels generate ids dynamically! can also be set to instance - used for structs.
var/link_below
/// id of above zlevel - overrides linkage if set. can be set to path, autoconverts to id on new.
/// can also be set to instance - used for structs.
/// id of above zlevel - overrides linkage if set.
///
/// * can also be set to path
/// * can also be set to instance - used for structs
/// * do not manually set it to levelpath::id, map levels generate ids dynamically! can also be set to instance - used for structs.
var/link_above
/// gas string / atmosphere path / atmosphere id for indoors air
/// if atmosphere path, it'll be automatically packed to ID on serialize, as we don't want to serialize paths to disk.
@@ -152,16 +170,6 @@
if(!isnull(parent_map))
id = "[parent_map.id]-[id]"
#define UNPACK_LINK(vname) if(ispath(vname, /datum/map_level)) { var/datum/map_level/cast_##vname = vname; vname = initial(cast_##vname.id) ; }
UNPACK_LINK(link_north)
UNPACK_LINK(link_south)
UNPACK_LINK(link_east)
UNPACK_LINK(link_west)
UNPACK_LINK(link_below)
UNPACK_LINK(link_above)
BLOCK_BYOND_BUG_2072419
#undef UNPACK_LINK
/datum/map_level/Destroy()
if(loaded)
. = QDEL_HINT_LETMELIVE
@@ -236,18 +244,36 @@
transition = data["transition"]
if(!isnull(data["base_turf"]))
base_turf = text2path(data["base_turf"])
// Resolve links, including if they got serlalized as typepaths.
// todo: typepaths should be trampled into ids on save instead.
var/resolving_link
var/maybe_link_path
if(!isnull(data["link_north"]))
link_north = data["link_north"]
resolving_link = data["north"]
maybe_link_path = text2path(resolving_link)
link_north = ispath(maybe_link_path) ? maybe_link_path : resolving_link
if(!isnull(data["link_south"]))
link_south = data["link_south"]
resolving_link = data["south"]
maybe_link_path = text2path(resolving_link)
link_south = ispath(maybe_link_path) ? maybe_link_path : resolving_link
if(!isnull(data["link_above"]))
link_above = data["link_above"]
resolving_link = data["above"]
maybe_link_path = text2path(resolving_link)
link_above = ispath(maybe_link_path) ? maybe_link_path : resolving_link
if(!isnull(data["link_below"]))
link_below = data["link_below"]
resolving_link = data["below"]
maybe_link_path = text2path(resolving_link)
link_below = ispath(maybe_link_path) ? maybe_link_path : resolving_link
if(!isnull(data["link_west"]))
link_west = data["link_west"]
resolving_link = data["west"]
maybe_link_path = text2path(resolving_link)
link_west = ispath(maybe_link_path) ? maybe_link_path : resolving_link
if(!isnull(data["link_east"]))
link_east = data["link_east"]
resolving_link = data["east"]
maybe_link_path = text2path(resolving_link)
link_east = ispath(maybe_link_path) ? maybe_link_path : resolving_link
if(!isnull(data["air_indoors"]))
air_indoors = data["air_indoors"]
if(!isnull(data["air_outdoors"]))