5 name:
"[Experimental] World Entity Setup (LOAD the world after this, do NOT save!)",
7 description:
"Set up GenericWorldEntity's Prefab",
9 wbModules: {
"WorldEditor" },
10 awesomeFontCode: 0xF0AC)]
11class SCR_WorldSetupPlugin_GenericWorldEntity : SCR_WorldSetupPluginBasePlugin
13 [
Attribute(
desc:
"The World Entity Prefab to be used for this world", uiwidget:
UIWidgets.ResourceNamePicker,
params:
"et class=GenericWorldEntity", defvalue:
"{08A95D735ECC517F}Prefabs/World/DefaultWorld/GenericWorld_Default.et")]
16 [
Attribute(defvalue:
"0",
desc:
"Create Prefab's child from the provided one in the selected addon and use it instead of using the provided Prefab directly")]
17 protected bool m_bCopyPrefabToAddon;
20 protected int m_iAddon;
22 protected static const string CHILD_PREFAB =
"%1_%2";
23 protected static const string LAYERS_DIR =
"%1_Layers";
24 protected static const string DEFAULT_LAYER =
"default.layer";
26 protected static const string WORLD_ENTITY_CLASS =
"GenericWorldEntity";
31 if (!Workbench.ScriptDialog(
"World Setup (WorldEntity)",
"This plugin replaces the current WorldEntity (generic entity or Prefab) by the provided Prefab.",
this))
36 if (worldEntityPrefab.IsEmpty())
42 WorldEditorAPI worldEditorAPI = SCR_WorldEditorToolHelper.GetWorldEditorAPI();
50 worldEditorAPI.GetWorldPath(worldPath);
54 if (m_bCopyPrefabToAddon)
55 worldEntityPrefab = CreatePrefabChildInAddon(worldEntityPrefab, m_iAddon, worldName);
57 if (worldEntityPrefab.IsEmpty())
63 if (SCR_WorldFilesHelper.ReplaceWorldEntity(worldPath, worldEntityPrefab))
64 Print(
"File written successfully. Please LOAD the world to see the changes applied",
LogLevel.NORMAL);
74 protected string GetDefaultLayerAbsoluteFilePath(
string worldPath,
string worldName)
76 string defaultLayerAbsFilePath;
77 if (!Workbench.GetAbsolutePath(worldPath, defaultLayerAbsFilePath))
79 Print(
"Could not get absolute path for " + worldPath,
LogLevel.WARNING);
83 string layerAbsDir =
FilePath.StripFileName(defaultLayerAbsFilePath);
84 if (!layerAbsDir.EndsWith(
"/"))
87 return layerAbsDir +
string.Format(LAYERS_DIR, worldName) +
"/" + DEFAULT_LAYER;
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
static ParamEnumArray FromAddons(int titleFormat=2, int hideCoreModules=0)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute