Refactors faction lists to use getters and setters and be cached (#94490)

This commit is contained in:
Bloop
2026-01-19 04:12:35 +01:00
committed by GitHub
parent 8a8e9f7c88
commit 68153c2333
158 changed files with 757 additions and 393 deletions
+9 -2
View File
@@ -102,6 +102,10 @@ GLOBAL_LIST_INIT(command_strings, list(
)
///name of the UI we will attempt to open
var/bot_ui = "SimpleBot"
// The faction of the bot before it inherited the pai's faction
var/list/original_faction
// The allies of the bot before it inherited the pai's faction
var/list/original_allies
/// If true we will offer this
COOLDOWN_DECLARE(offer_ghosts_cooldown)
@@ -706,7 +710,9 @@ GLOBAL_LIST_INIT(command_strings, list(
paicard.pai.mind.transfer_to(src)
to_chat(src, span_notice("You sense your form change as you are uploaded into [src]."))
name = paicard.pai.name
faction = user.faction.Copy()
original_faction = get_faction()
original_allies = allies
SET_FACTION_AND_ALLIES_FROM(src, user)
log_combat(user, paicard.pai, "uploaded to [initial(src.name)],")
return TRUE
@@ -737,7 +743,8 @@ GLOBAL_LIST_INIT(command_strings, list(
to_chat(paicard.pai, span_notice("You feel your control fade as [paicard] ejects from [initial(name)]."))
paicard = null
name = initial(name)
faction = initial(faction)
set_faction(original_faction)
set_allies(original_allies)
remove_all_languages(source = LANGUAGE_PAI)
get_selected_language()
@@ -185,7 +185,7 @@
continue
if(!HAS_TRAIT(human_target, TRAIT_CLEANBOT_WHISPERER))
continue
if((living_pawn.faction.Find(REF(human_target))))
if(living_pawn.has_ally(REF(human_target)))
continue
return human_target
return null
+1 -1
View File
@@ -109,7 +109,7 @@
/datum/action/cooldown/mob_cooldown/exenterate/proc/slash_em(atom/caster)
for(var/mob/living/victim in range(ability_range, caster))
if(faction_check(victim.faction, immune_factions) && victim.IsReachableBy(owner))
if(victim.has_faction(immune_factions) && victim.IsReachableBy(owner))
continue
to_chat(caster, span_warning("You slice [victim]!"))
to_chat(victim, span_warning("You are cut by [caster]'s blades!"))