Fantastic job. Just FYI
I wanted to help and I believe I found a bug in V4:
var idx
var removeId
var tempslave
for i in range(count):
idx = randi() % (slaves.size()*7/4) % slaves.size()
removeId = slaves[idx].id
for id in slaves[idx].relations:
tempslave = globals.state.findslave(id)
if tempslave:tempslave.relations.remove(removeId)
slaves.remove(idx)
This part can throw the following error:
SCRIPT ERROR: _on_end_pressed: Invalid call. Nonexistent function 'remove' in base 'Dictionary'.
At: res://files/scripts/Mansion.gd:1254
I do not know how to help at all with that (or which function to use to remove elements from a dictionary), but I believe this code was not there in V3.
Cheers!
EDIT: According to
https://docs.godotengine.org/en/stable/classes/class_dictionary.html
replacing "remove" by "erase" seems to fix the issue. Hope it helps.