Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/globalscripts/Resources.js
/** | /** | ||||
* Since the AI context can't access JSON functions, it gets passed an object | * Since the AI context can't access JSON functions, it gets passed an object | ||||
* containing the information from `GuiInterface.js::GetSimulationState()`. | * containing the information from `GuiInterface.js::GetSimulationState()`. | ||||
*/ | */ | ||||
function Resources() | function Resources() | ||||
{ | { | ||||
let jsonFiles = []; | let jsonFiles = []; | ||||
// Simulation context | // Simulation context | ||||
if (Engine.FindJSONFiles) | if (Engine.FindJSONFiles) | ||||
{ | { | ||||
jsonFiles = Engine.FindJSONFiles("resources", false); | jsonFiles = Engine.FindJSONFiles("resources", false); | ||||
for (let file in jsonFiles) | for (let file in jsonFiles) | ||||
jsonFiles[file] = "resources/" + jsonFiles[file] + ".json"; | jsonFiles[file] = "simulation/data/resources/" + jsonFiles[file] + ".json"; | ||||
} | } | ||||
// GUI context | // GUI context | ||||
else if (Engine.BuildDirEntList) | else if (Engine.BuildDirEntList) | ||||
jsonFiles = Engine.BuildDirEntList("simulation/data/resources/", "*.json", false); | jsonFiles = Engine.BuildDirEntList("simulation/data/resources/", "*.json", false); | ||||
else | else | ||||
{ | { | ||||
error("Resources: JSON functions are not available"); | error("Resources: JSON functions are not available"); | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator