sidrefresh's picture
Add files using upload-large-folder tool
7ec48b5 verified
Raw History Blame Contribute Delete
1.95 kB
/* Verifier-side reader: reopens a saved park in a separate headless engine and
prints its state once. It counts land ownership itself rather than trusting
anything the run recorded, and reports the configuration markers so a park
that was not the scenario this task hands out cannot be graded as one. */
registerPlugin({name:"onetile-verifier",version:"1.0",authors:["Verifier"],type:"local",licence:"MIT",targetApiVersion:122,main:function(){
var store=context.getParkStorage("onetile-v1");
var owned=0,forSale=0;
for(var x=1;x<=map.size.x-2;x++){
for(var y=1;y<=map.size.y-2;y++){
var tile=map.getTile(x,y);
for(var i=0;i<tile.numElements;i++){
var element=tile.getElement(i);
if(element.type!=="surface")continue;
if(element.ownership&2)owned++; // landOwned
else if(element.ownership&8)forSale++; // landForSale
}
}
}
console.log("T39JSON "+JSON.stringify({kind:"load",
origin:store.get("origin",null),outcome:store.get("outcome",null),
baseline:store.get("baseline",null),inGameDays:store.get("inGameDays",null),
scenarioStatus:scenario.status,objectiveType:scenario.objective.type,
objectiveGuests:scenario.objective.guests,completedCompanyValue:scenario.completedCompanyValue,
ratingWarningDays:scenario.parkRatingWarningDays,
guests:park.guests,rating:park.rating,cash:park.cash,
loan:park.bankLoan,maxLoan:park.maxBankLoan,
landPrice:park.landPrice,entranceFee:park.entranceFee,
parkOpen:park.getFlag("open"),freeParkEntry:park.getFlag("freeParkEntry"),
unlockAllPrices:park.getFlag("unlockAllPrices"),
mapSizeX:map.size.x,mapSizeY:map.size.y,
ownedTiles:owned,tilesForSale:forSale,parkSize:park.parkSize,
monthsElapsed:date.monthsElapsed,day:date.day,month:date.month,year:date.year,
rides:map.rides.map(function(r){return {id:r.id,name:r.name,classification:r.classification,status:r.status,totalCustomers:r.totalCustomers,excitement:r.excitement,intensity:r.intensity};})}));
}});