Improve AI garrisons, player recovery and mission administration
This commit is contained in:
@@ -4,7 +4,7 @@ from policy_harness import ROOT, body, run
|
||||
MODE = ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_GameMode.c'
|
||||
SPAWN = ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_SpawnLogic.c'
|
||||
def cpp(s):
|
||||
s=s.replace('protected ', '').replace('Replication.IsServer()', 'server').replace('Replication.BumpMe()', '(void)0')
|
||||
s=s.replace('ERR_HQ.Event','ERR_HQ::Event').replace('protected ', '').replace('Replication.IsServer()', 'server').replace('Replication.BumpMe()', '(void)0')
|
||||
s=s.replace('array<int> connected = {};','std::vector<int> connected;').replace('connected.IsEmpty()', 'connected.empty()')
|
||||
s=s.replace('foreach (int id : connected)', 'for (int id : connected)')
|
||||
s=s.replace('ERR_PlayerLife life', 'Life* life').replace('SCR_PlayerController controller', 'Controller* controller').replace('PlayerController controller', 'Controller* controller')
|
||||
@@ -25,7 +25,8 @@ struct Roster {std::map<int,Life> lives;bool survivor=false;Life* Get(int id){au
|
||||
struct Players {std::map<int,Controller*> connected;void GetPlayers(std::vector<int>& v){for(auto p:connected)v.push_back(p.first);}int GetPlayerCount(){return connected.size();}Controller* GetPlayerController(int id){auto i=connected.find(id);return i==connected.end()?nullptr:i->second;}};
|
||||
struct Game {Players players;Players* GetPlayerManager(){return &players;}} game;Game* GetGame(){return &game;}
|
||||
struct World {float now=0;float GetWorldTime(){return now;}} world;
|
||||
struct Service {void Tick(float=0){}void Maintain(float){}void Invoke(float){}};
|
||||
struct ERR_HQ {static void Event(std::string,std::string){}};
|
||||
struct Service {bool defeat=false;bool DefeatDue(float){return defeat;}void Tick(float=0){}void Maintain(float){}void Invoke(float){}};
|
||||
struct Exhausted {std::map<int,Controller*> values;void Remove(int id){values.erase(id);}void Set(int id,Controller* c){values[id]=c;}bool Contains(int id){return values.count(id);}Controller* Get(int id){return values.at(id);}};
|
||||
struct Mode {
|
||||
void TickForces(float){}
|
||||
@@ -37,6 +38,8 @@ struct Mode {
|
||||
};
|
||||
struct Fixture {Mode m;Controller first,second;Fixture(){server=true;world.now=0;game.players.connected={{1,&first}};m.roster.lives[1]=Life();}void tick(float t){world.now=t;m.ServerTick();}void exhaust(){m.InitialAdmissionExhausted(1,&first);}};
|
||||
int main(){
|
||||
{Fixture f;f.m.roster.survivor=true;f.m.service.defeat=true;f.tick(31000);
|
||||
assert(!f.m.Active() && f.m.m_EndReason=="All prisoners are unconscious and no treatment or recovery is progressing.");}
|
||||
// Sole exhausted first admission reaches existing grace, without a life/body.
|
||||
{Fixture f;f.exhaust();f.tick(0);f.tick(29999);assert(f.m.Active());f.tick(30000);
|
||||
assert(f.m.m_Phase==5&&!f.m.m_StartedPlayers&&!f.m.roster.lives[1].UsedLife);
|
||||
|
||||
Reference in New Issue
Block a user