Add ground starting supplies and mission telemetry; record Workshop 0.0.123
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -27,13 +27,14 @@ def cpp(s):
|
||||
s=s.replace('GetGame().GetWorld().GetWorldTime()', 'clockNow')
|
||||
s=s.replace('string.Format(', 'Format(')
|
||||
s=s.replace('int visited;', 'int visited=0;').replace('int pending, accepted, pendingGuards;', 'int pending=0, accepted=0, pendingGuards=0;')
|
||||
s=s.replace('int pendingGuards;', 'int pendingGuards=0;').replace('int pending, accepted;', 'int pending=0, accepted=0;')
|
||||
s=s.replace('int pendingTransports;', 'int pendingTransports=0;').replace('bool driver, passenger;', 'bool driver=false, passenger=false;')
|
||||
s=s.replace('if (!GetGame()) return;', '')
|
||||
return s
|
||||
methods='\n'.join(cpp(body(source,sig)) for sig in (
|
||||
'protected bool TransportEmpty(', 'protected bool TransportFailure(',
|
||||
'protected bool CreateTransport(', 'protected bool TransportReady(',
|
||||
'protected bool Fail(', 'ERR_PrepareResult Prepare(', 'void Rollback(', 'void Stop('))
|
||||
'protected bool Fail(', 'protected ERR_PrepareResult PrepareStock(', 'ERR_PrepareResult Prepare(', 'void Rollback(', 'void Stop('))
|
||||
run(r'''
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
@@ -72,14 +73,15 @@ struct ERR_SiteTransport_ {bool Optional=false;int Prefab=123;vector Offset{};fl
|
||||
struct Definition {ERR_SiteTransport Transport=nullptr;string Id="clue-site";vector Position{};};
|
||||
struct LocationType{bool prepared=false;void SetPrepared(bool value){prepared=value;}};
|
||||
struct Site {LocationType*Location=nullptr;struct Definition* Definition=nullptr;IEntity Transport=nullptr,TransportEntity=nullptr;bool TransportAttempted=false,TransportOmitted=false;float TransportDeadline=-1;Site* Responders=nullptr;int guard=PENDING;};using ERR_SiteRuntime=Site*;
|
||||
struct Inventory{Array<IEntity>items;bool accept=true;int calls=0;void GetItems(Array<IEntity>&out){out=items;}bool TryInsertItem(IEntity){calls++;return accept;}};
|
||||
struct Placement{IEntity Item=nullptr;Inventory* Inventory_=nullptr;bool Accepted=false,Optional=false,Skipped=false;};
|
||||
struct Inventory{Array<IEntity>items;bool accept=true;int calls=0;void GetItems(Array<IEntity>&out){out=items;}bool CanInsertItem(IEntity){return accept;}bool TryInsertItem(IEntity){calls++;return accept;}};
|
||||
struct Placement{IEntity Item=nullptr;Inventory* Inventory_=nullptr;bool Accepted=false,Optional=false,Skipped=false,OnGround=false;};
|
||||
struct Extraction{ERR_PrepareResult result=READY;int stops=0;ERR_PrepareResult Poll(float){return result;}string FailureReason(){return "aircraft failed";}void Stop(){stops++;}};
|
||||
struct ExtractionStatus{bool pickup=true;bool PickupConfigured(){return pickup;}};
|
||||
struct Mode{ExtractionStatus status;ExtractionStatus&Extraction(){return status;}Array<IEntity>owned;void Own(IEntity e){owned.Insert(e);}};
|
||||
using ERR_StockPlacement=Placement*;
|
||||
struct Service{Mode mode;Mode* m_Mode=&mode;Extraction extraction;Extraction* m_ExtractionPlacement=&extraction;Array<ERR_SiteRuntime>m_Sites;Array<IEntity>m_Entities;Array<ERR_StockPlacement>m_Placements;
|
||||
bool m_Begun=true,m_Stopped=false,m_SingleSite=false,clear=true;int guardChecks=0,cancels=0,patrolStops=0;ERR_PrepareResult m_State=PENDING;float m_Deadline=15000;string m_FailureReason;
|
||||
void LeaveStartingItem(ERR_StockPlacement p){p->Skipped=true;}
|
||||
bool TransportClearance(vector,float,float){return clear;}
|
||||
ERR_PrepareResult InitialGuards(ERR_SiteRuntime site){guardChecks++;if(site->guard==FAILED){Fail("guards failed");return FAILED;}return ERR_PrepareResult(site->guard);}
|
||||
void CancelInitialGuardRequests(){cancels++;}void StopPatrols(){patrolStops++;}
|
||||
|
||||
Reference in New Issue
Block a user