Build independent base gameplay and source-bound native verification

This commit is contained in:
2026-09-19 08:09:14 +02:00
parent 16f397e581
commit af5146a317
580 changed files with 65780 additions and 107 deletions
+45
View File
@@ -0,0 +1,45 @@
"""Run the actual fixture method against a narrow native-damage API fake."""
from policy_harness import ROOT, body, run
p=ROOT/'addons/core/Scripts/Game/ERR/ERR_NativeCasualtyLoadProbe.c'
method=body(p,'protected bool IncapacitateGroundCasualty(')
method=method.replace('protected bool','bool').replace('m_Damage.','m_Damage->').replace('resilience.','resilience->').replace('ERR_Actors.','ERR_Actors::').replace('null','nullptr')
run('''
#include <cassert>
#include <initializer_list>
struct NativeHitZone { float health=100; float GetHealth(){return health;} };
using HitZone=NativeHitZone*;
struct Actor { bool alive=true; };
struct Damage {
NativeHitZone resilience; bool enabled=true, missing=false, swallow=false; int forces=0;
HitZone GetResilienceHitZone(){return missing ? nullptr : &resilience;}
bool IsDamageHandlingEnabled(){return enabled;}
void EnableDamageHandling(bool value){enabled=value;}
void ForceUnconsciousness(){forces++; if(enabled && !swallow)resilience.health=0;}
};
struct ERR_Actors {static bool Alive(Actor* actor){return actor && actor->alive;}};
Actor* m_Casualty; Damage* m_Damage;
bool Check(bool value,const char*){return value;}
template<class... Args> void PrintFormat(const char*,Args...){}
'''+method+'''
int main(){
Actor actor; m_Casualty=&actor;
for(bool original:{false,true}) {
Damage damage; m_Damage=&damage; damage.enabled=original;
assert(IncapacitateGroundCasualty());
assert(damage.forces==1 && damage.resilience.health==0 && actor.alive);
assert(damage.enabled==original);
// No second artificial reduction: already-zero initial state must fail.
assert(!IncapacitateGroundCasualty());
assert(damage.enabled==original);
}
Damage blocked; blocked.enabled=false; blocked.swallow=true; m_Damage=&blocked;
assert(!IncapacitateGroundCasualty());
assert(blocked.forces==1 && !blocked.enabled && actor.alive);
Damage missing; missing.missing=true; m_Damage=&missing;
assert(!IncapacitateGroundCasualty() && missing.forces==0);
m_Damage=nullptr; assert(!IncapacitateGroundCasualty());
Damage dead; m_Damage=&dead; actor.alive=false;
assert(!IncapacitateGroundCasualty() && dead.forces==0);
}
''')
print('PASS: actual fixture method permits one native resilience operation and restores either prior protection state, including failure paths')