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:
@@ -1,7 +1,7 @@
|
||||
"""Execute production starting-supply validation, edits, mode switches and save guards."""
|
||||
from policy_harness import ROOT, body, run
|
||||
p=ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_StartBackpack.c'
|
||||
methods='\n'.join(body(p,n) for n in ['static bool Valid(', 'protected bool Save(', 'bool Custom(', 'bool SetMode(', 'bool Set(', 'bool Remove('])
|
||||
methods='\n'.join(body(p,n) for n in ['static string Destination(', 'static bool Valid(', 'protected bool Save(', 'bool Custom(', 'bool SetMode(', 'bool Set(', 'bool Remove('])
|
||||
methods=methods.replace('protected ','').replace('array<string>', 'Array<string>').replace('set<string> seen = new set<string>();','Array<string> seen;').replace('!records || ', '').replace('ResourceName','string').replace('quantity.ToString()', 'string(std::to_string(quantity))')
|
||||
methods=methods.replace('int total;', 'int total = 0;')
|
||||
methods=methods.replace('ERR_TerrainCatalog.Key','Key').replace('ERR_ItemPreferences.Guid','Guid').replace('ERR_CommandArguments.Integer','Integer').replace('Replication.IsServer()', 'authority').replace('ERR_ProfileConfig.Save(PATH, json)', 'Persist(json)').replace('JsonSaveContext json = new JsonSaveContext();','JsonSaveContext json;')
|
||||
@@ -26,6 +26,14 @@ int main(){
|
||||
string a="{AAAAAAAAAAAAAAAA}Prefabs/rifle.et",b="{BBBBBBBBBBBBBBBB}Prefabs/magazine.et";
|
||||
Supplies s;assert(!s.Custom());assert(s.Set(a,2)&&s.Set(b,4)&&s.m_Records.size()==3);
|
||||
assert(s.SetMode(true)&&s.Custom());assert(s.Set(a,3)&&s.m_Records.size()==3);
|
||||
assert(s.Set(a,2,"ground")&&s.m_Records.size()==4);
|
||||
assert(s.Remove("aaaaaaaaaaaaaaaa","ground")&&s.m_Records.size()==3);
|
||||
assert(!s.Remove("aaaaaaaaaaaaaaaa","ground"));
|
||||
assert(!s.Set(a,1,"invalid"));
|
||||
assert(Supplies::Valid({"custom",a+"|2",a+"|3|ground"})); // legacy bag plus ground
|
||||
assert(!Supplies::Valid({"custom",a+"|2",a+"|3|backpack"})); // duplicate old/new bag entry
|
||||
assert(!Supplies::Valid({"custom",a+"|48|ground",a+"|17|backpack"}));
|
||||
assert(!Supplies::Valid({"custom",a+"|2|ground",a+"|3|ground"}));
|
||||
auto saved=s.m_Records;s.fail=true;assert(!s.SetMode(false)&&!s.Remove("aaaaaaaaaaaaaaaa")&&s.m_Records==saved);s.fail=false;
|
||||
s.authority=false;assert(!s.Set(a,1)&&!s.SetMode(false)&&s.m_Records==saved);s.authority=true;
|
||||
s.m_ReadOnly=true;assert(!s.Set(b,1)&&s.m_Records==saved);s.m_ReadOnly=false;
|
||||
@@ -44,9 +52,15 @@ int main(){
|
||||
session=ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_AdminSession.c'
|
||||
assert body(session,'void Command(').index('if (!Authorize()) return;') < body(session,'void Command(').index('StartBackpackCommand(')
|
||||
command=body(session,'protected bool StartBackpackCommand(')
|
||||
assert command.index('catalog.Contains(parts[2], parts[3])') < command.index('supplies.Set(item.Prefab, count)')
|
||||
assert command.index('catalog.Contains(parts[2], parts[3])') < command.index('supplies.Set(item.Prefab, count, destination)')
|
||||
stock=(ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_SiteService.c').read_text()
|
||||
assert 'spec.Kind == ERR_LocationKind.PRISON && !customStart' in stock
|
||||
assert 'placement.Optional && GetGame().GetWorld().GetWorldTime() > m_Deadline' in stock
|
||||
assert 'ERR_Actors.DeleteSpawned(placement.Item); placement.Skipped = true;' in stock
|
||||
assert 'placement.Optional && (expired || (!placement.Accepted && !placement.Inventory.CanInsertItem(placement.Item)))' in stock
|
||||
assert 'LeaveStartingItem(placement); continue;' in stock
|
||||
assert 'ERR_Actors.DeleteSpawned(placement.Item)' not in stock
|
||||
print('PASS: exact starting-stock edits, quantities/type/total limits, duplicate rejection, saved custom/default modes, authority/read-only/save-failure retention and authenticated catalog routing')
|
||||
|
||||
assert '(version == 1 || version == 2)' in p.read_text()
|
||||
assert 'item.OnGround = Destination(parts) == "ground"' in p.read_text()
|
||||
assert 'placement.OnGround = customStart && stock.OnGround;' in stock
|
||||
assert 'if (placement.OnGround) { LeaveStartingItem(placement); continue; }' in stock
|
||||
|
||||
Reference in New Issue
Block a user