Merge owned systems into one addon while preserving resource identities. Gate player admission on the replicated prison scene, restore the original framed door, and hold enemy AI until escape. Correct scenario branding and author metadata, include publishing assets, and retain regression and native verification evidence.
44 lines
2.5 KiB
Python
44 lines
2.5 KiB
Python
"""Fixture boundaries and actual safe-exit policy; not an engine substitute."""
|
|
from policy_harness import ROOT, body, run
|
|
import re
|
|
source = ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_NativeCasualtyRemoveProbe.c'
|
|
method = body(source,'static bool SafeExit(')
|
|
method = re.sub(r'(?<![\w.])(\d+\.\d+)(?![\w.])',r'\1f',method)
|
|
run('#include <cassert>\n'+method+'''
|
|
int main() {
|
|
assert(SafeExit(0,0));
|
|
assert(SafeExit(1.25,-0.25));
|
|
assert(SafeExit(1.25,1.5));
|
|
assert(!SafeExit(1.251,0));
|
|
assert(!SafeExit(-0.01,0));
|
|
assert(!SafeExit(1,-0.251));
|
|
assert(!SafeExit(1,1.501));
|
|
}
|
|
''')
|
|
text=source.read_text()
|
|
assert text.startswith('#ifdef WORKBENCH')
|
|
assert 'GetContextIndex("door_l01_door") >= 0' in text
|
|
assert 'actions.Contains(m_Remove)' in text
|
|
assert 'PickDoorIndexForPoint(m_Context.GetOrigin())' in text
|
|
assert 'GetExitTeleportPointInfo()' in text
|
|
assert 'm_Remove.GetActionDuration() == 1' in text
|
|
assert 'm_Remove.CanBeShown(m_Caller)' in text and 'm_Remove.CanBePerformed(m_Caller)' in text
|
|
assert text.count('m_Remove.PerformAction(') == 1
|
|
assert 'm_Remove.SetCompartmentDoorInfoIndex(m_SavedDoor)' in body(source,'override void Cleanup(')
|
|
assert 'if (m_RemoveStopped) return -1;' in body(source,'override int Tick(')
|
|
for forbidden in ('GetOutVehicle(', 'GetOutVehicle_NoDoor(', 'KickFromVehicle(', 'SetUnconscious(', 'm_Casualty.Set', 'm_Casualty).Teleport', 'SetActive('):
|
|
assert forbidden not in text,forbidden
|
|
# Existing arbitrary-ground mechanism remains exactly its original contract.
|
|
base=ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_NativeCasualtyLoadProbe.c'
|
|
assert 'GetOutVehicle_NoDoor(exitTransform, true, false)' in body(base,'protected bool BeginExit(')
|
|
assert 'exitTransform[3] = m_GroundPosition;' in body(base,'protected bool BeginExit(')
|
|
assert body(base,'protected bool ExitSettled(').strip().endswith('return ERR_Actors.Alive(m_Casualty) && vector.Distance(m_Casualty.GetOrigin(), m_GroundPosition) < 4 && m_Seat.IsCompartmentAccessible();\n }')
|
|
base_text=(ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_NativeBaseSmoke.c').read_text()
|
|
assert base_text.count('m_ERRExtractionCase == "casualty-remove"') == 3
|
|
assert 'm_ERRCasualtyLoadProbe = new ERR_NativeCasualtyRemoveProbe(this);' in base_text
|
|
assert 'm_ERRBaseStep = 802; Transition(ERR_Phase.DEFEAT);' in base_text
|
|
runner=(ROOT/'tools/headless_workbench.py').read_text()
|
|
assert runner.count("'casualty-remove'") == 3
|
|
compile(runner,'headless_workbench.py','exec')
|
|
print('PASS: actual safe-exit boundary policy, native action/door selection, stop/cache cleanup, separate old mechanism and opt-in runner contracts')
|