Polaris icon indicating copy to clipboard operation
Polaris copied to clipboard

Changes alien_whitelist to an assoc list of ckeys

Open Atermonera opened this issue 2 years ago • 2 comments

This makes me sad: image

This change maybe addresses that? It can't be slower.

Atermonera avatar May 01 '22 18:05 Atermonera

Parsing it all once at load to (like the PR name, before the regex add) a structure like list(ckey = list(name, name, ...), ...) may be preferable in the end, since then the matter of is_alien_whitelisted reduces to just

.../is_alien_whitelisted(mob/M, species/S)
  return (S?.name in alien_whitelist?[ckey(M?.ckey)])

(which is terribly resilient to nulls, as an aside)

Spookerton avatar May 03 '22 10:05 Spookerton

nb: because this uses the single monolithic file approach, the regex the whole thing or pre-parse the whole thing approaches are necessary. Were it sqlite, json-per-user in player_saves, or some other oob store, you could load the data per-client, reducing work and making in-game editing of allow lists more reasonable.

(this is not directly PR relevant ofc; musings for a potential future redo)

Spookerton avatar May 07 '22 09:05 Spookerton

Closing this since you already put in an alternative. Reopen if necessary.

Spookerton avatar Nov 07 '22 13:11 Spookerton