Integrate startup optics and supply vehicle lock picking
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
"""Execute both production monitor bodies; native hint/camera boundaries are fakes."""
|
||||
from policy_harness import ROOT, body, run
|
||||
GUIDE=ROOT/'addons/core/Scripts/Game/ERR/ERR_PlayerGuide.c'
|
||||
from pathlib import Path
|
||||
import os
|
||||
GUIDE=Path(os.environ.get('ERR_GUIDE_SOURCE', ROOT/'addons/core/Scripts/Game/ERR/ERR_PlayerGuide.c'))
|
||||
OBSERVER=ROOT/'addons/core/Scripts/Game/ERR/ERR_Observer.c'
|
||||
def cpp(text):
|
||||
text=text.replace('protected ', '')
|
||||
text=text.replace('protected ', '').replace('override ', '').replace('super.OnControlledEntityChanged(from, to);', 'nativeChanges++;')
|
||||
for name in ('ERR_GameMode','ERR_Phase','ERR_ObserverReason','ERR_Actors','ERR_ObjectiveText','SCR_HintManagerComponent','ERR_ObserverGuidance','Resource','ETransformMode','SCR_ManualCamera','SCR_RespawnSystemComponent','RplId'):
|
||||
text=text.replace(name+'.',name+'::')
|
||||
for typename in ('ERR_GameMode','SCR_HintManagerComponent','Resource','SCR_RespawnSystemComponent','CameraManager'):
|
||||
@@ -12,14 +14,14 @@ def cpp(text):
|
||||
text=text.replace(variable+'.',variable+'->')
|
||||
text=text.replace('GetGame().','GetGame()->').replace('EntitySpawnParams params = new EntitySpawnParams();','EntitySpawnParams params;')
|
||||
return text
|
||||
methods=cpp(body(GUIDE,'protected void ERR_UpdateGuide('))+'\n'+cpp(body(OBSERVER,'protected void ERR_UpdateObserverClient('))
|
||||
methods=cpp(body(GUIDE,'override void OnControlledEntityChanged('))+'\n'+cpp(body(GUIDE,'protected void ERR_UpdateGuide('))+'\n'+cpp(body(OBSERVER,'protected void ERR_UpdateObserverClient('))
|
||||
guidance=cpp(body(OBSERVER,'static string Message('))+'\n'+cpp(body(OBSERVER,'static bool Refresh('))
|
||||
run(r'''#include <cassert>
|
||||
#include <string>
|
||||
struct string:std::string {using std::string::string;using std::string::operator=;string(std::string s):std::string(s){}bool IsEmpty()const{return empty();}};
|
||||
namespace ERR_Phase {enum {PREPARING,PRISON,RADIO_SEARCH,RADIO_DEFENCE,EXTRACTION};}
|
||||
namespace ERR_ObserverReason {enum {NONE,SPENT_LIFE,LATE_EXTRACTION,SPAWN_UNAVAILABLE};}
|
||||
struct Actor {bool alive=true;bool unconscious=false;} actor;
|
||||
struct Actor {bool alive=true;bool unconscious=false;} actor;using IEntity=Actor*;
|
||||
struct ERR_Actors {static bool Alive(Actor* a){return a&&a->alive;}};
|
||||
struct ERR_GameMode {int phase=ERR_Phase::PRISON;bool active=true;string message="prison";static ERR_GameMode* current;static ERR_GameMode* Get(){return current;}int Phase(){return phase;}bool Active(){return active;}} mode;
|
||||
ERR_GameMode* ERR_GameMode::current=&mode;
|
||||
@@ -42,6 +44,7 @@ struct RplId {static int Invalid(){return -1;}};
|
||||
struct Game {int spawns=0;SCR_ManualCamera* SpawnEntityPrefab(Resource*,int,EntitySpawnParams){spawns++;return &camera;}int GetWorld(){return 1;}CameraManager* GetCameraManager(){return &manager;}} game;
|
||||
Game* GetGame(){return &game;}
|
||||
struct Controller {
|
||||
int nativeChanges=0,starts=0;void ERR_StartGuide(){starts++;}
|
||||
int m_ERRGuidePhase=-1;string m_ERRGuideMessage;
|
||||
Actor* controlled=&actor;int m_ERRObserverReason=ERR_ObserverReason::NONE;
|
||||
SCR_ManualCamera* m_ERRObserverCamera=nullptr;Vec m_ERRObserverAnchor;
|
||||
@@ -64,6 +67,19 @@ int main(){
|
||||
mode.message="transmission interrupted";hints.accepts=false;g.ERR_UpdateGuide();assert(g.m_ERRGuideMessage=="prison");
|
||||
hints.accepts=true;g.ERR_UpdateGuide();assert(hints.shown==2&&g.m_ERRGuideMessage==mode.message);
|
||||
mode.phase=ERR_Phase::RADIO_SEARCH;g.ERR_UpdateGuide();assert(hints.shown==3);
|
||||
// Reacquiring a character in the same phase clears delivery once; native
|
||||
// lifecycle and the existing monitor remain responsible for actual delivery.
|
||||
Actor replacement;int shown=hints.shown;
|
||||
g.OnControlledEntityChanged(&actor,&replacement);g.controlled=&replacement;
|
||||
assert(g.nativeChanges==1&&g.starts==1&&g.m_ERRGuidePhase==-1);
|
||||
hints.accepts=false;g.ERR_UpdateGuide();assert(hints.shown==shown&&g.m_ERRGuidePhase==-1);
|
||||
hints.accepts=true;g.ERR_UpdateGuide();assert(hints.shown==shown+1);
|
||||
g.ERR_UpdateGuide();assert(hints.shown==shown+1);
|
||||
g.OnControlledEntityChanged(&replacement,&replacement);g.ERR_UpdateGuide();assert(hints.shown==shown+1);
|
||||
g.OnControlledEntityChanged(&replacement,nullptr);g.controlled=nullptr;
|
||||
g.ERR_UpdateGuide();assert(hints.shown==shown+1);
|
||||
g.OnControlledEntityChanged(nullptr,&replacement);g.controlled=&replacement;
|
||||
g.ERR_UpdateGuide();assert(hints.shown==shown+2&&g.nativeChanges==4&&g.starts==4);
|
||||
// Explicit observation, death and absence suppress ordinary phase instructions.
|
||||
for(int excluded=0;excluded<3;excluded++){
|
||||
Controller c;if(excluded==0)c.m_ERRObserverReason=ERR_ObserverReason::SPENT_LIFE;
|
||||
|
||||
Reference in New Issue
Block a user