myspace / Data /ClassDef-Satellite View.lua
sirnii's picture
Upload 1816 files
b6a38d7 verified
raw
history blame
63.6 kB
-- ========== GENERATED BY ClassDef Editor (Ctrl-Alt-F3) DO NOT EDIT MANUALLY! ==========
PlaceObj('ClassDef', {
group = "Satellite View",
id = "Camp",
PlaceObj('PropertyDefNumber', {
'id', "Standing",
'default', 0,
'min', -100,
'max', 100,
}),
})
PlaceObj('ClassDef', {
DefParentClassList = {
"CampaignObject",
},
group = "Satellite View",
id = "CampaignCity",
PlaceObj('PropertyDefText', {
'id', "Id",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "DisplayName",
'name', "Display Name",
}),
PlaceObj('PropertyDefNumber', {
'id', "Loyalty",
'name', "Loyalty",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefText', {
'id', "template_key",
'read_only', true,
'no_edit', true,
'translate', false,
}),
PlaceObj('ClassMethodDef', {
'name', "GetEditorView",
'code', function (self)
return self.DisplayName or Untranslated(self.Id or "(unnamed city)")
end,
}),
PlaceObj('PropertyDefNumber', {
'id', "currentCivilianDeathPenalty",
'name', "",
'no_edit', true,
'default', 0,
'min', 0,
'max', 30,
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "EnemySquadUnit",
PlaceObj('ClassMethodDef', {
'name', "GetError",
'code', function (self)
if not self.weightedList then
return "Choose at least one unit type"
elseif not self.UnitCountMin or not self.UnitCountMax then
return "Choose units count range (min-max)"
elseif self.UnitCountMin > self.UnitCountMax then
return "min should not be more than max"
end
end,
}),
PlaceObj('PropertyDefNestedList', {
'id', "weightedList",
'name', "Unit List",
'help', "Weighted list with unit types to choose from",
'base_class', "UnitTypeListWithWeights",
}),
PlaceObj('ClassMethodDef', {
'name', "GetEditorView",
'code', function (self)
if self.weightedList then
return tostring(self.UnitCountMin).."-"..tostring(self.UnitCountMax).." {"..table.concat(table.map(self.weightedList, "unitType"), "/").."}"
end
end,
}),
PlaceObj('PropertyDefNumber', {
'id', "UnitCountMin",
'name', "Unit Count Min",
'min', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "UnitCountMax",
'name', "Unit Count Max",
'min', 0,
}),
})
PlaceObj('PresetDef', {
DefEditorIcon = "CommonAssets/UI/Icons/delivery fast packing truck.png",
DefEditorMenubar = "Scripting",
DefEditorName = "Event Operation Outcomes",
DefGlobalMap = "EventOperationsOutcomes",
DefHasParameters = true,
group = "Satellite View",
id = "EventOperationOutcome",
PlaceObj('PropertyDefNumber', {
'id', "Weight",
'help', "Event 'Weight' when choose outcome",
}),
PlaceObj('PropertyDefChoice', {
'id', "Stat",
'name', "Unit Stat",
'help', "Weight depends from that stat",
'items', function (self) return GetUnitStatsCombo() end,
}),
PlaceObj('PropertyDefBool', {
'id', "Desending",
'help', "The way the weight depends from the stat. Desending: heigher stat->lower weight",
}),
PlaceObj('PropertyDefPresetId', {
'id', "PopupId",
'preset_class', "PopupNotification",
'preset_group', "Outcome",
}),
PlaceObj('PropertyDefFunc', {
'id', "Condition",
'params', "self,operation_id,sector, mercs",
'default', function (self,operation_id,sector, mercs)
return true
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "Effect",
'params', "self,operation_id,sector, mercs",
}),
PlaceObj('ClassMethodDef', {
'name', "GetWeight",
'params', "operation_id, sector, mercs",
'code', function (self, operation_id, sector, mercs)
if self.Weight and self.Weight>0 then
return self.Weight
end
local stat = self.Stat
if stat and mercs and #mercs>0 then
local max_merc = table.max(mercs, function(m) return m[stat] end )
local max_stat = max_merc[stat]
return self.Descending and Min((100-max_stat), 20) or max_stat
end
return 0
end,
}),
})
PlaceObj('ClassDef', {
DefParentClassList = {
"CampaignObject",
},
group = "Satellite View",
id = "Intel",
PlaceObj('PropertyDefText', {
'id', "Id",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "Description",
}),
PlaceObj('PropertyDefBool', {
'id', "Discoverable",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "discovered",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'id', "sector_id",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "template_key",
'no_edit', true,
'translate', false,
}),
PlaceObj('ClassMethodDef', {
'name', "GetCampaignTemplate",
'code', function (self)
if self.template_key and Game and Game.Campaign and CampaignPresets[Game.Campaign] then
local campaign = CampaignPresets[Game.Campaign]
local sector = table.find_value(campaign.Sectors, "Id", self.sector_id)
return sector and sector.Intel and table.find_value(sector.Intel, "Id", self.Id)
end
end,
}),
PlaceObj('ClassMethodDef', {
'name', "LoadFirstPriorityProps",
'params', "prop_data, obj",
'code', function (self, prop_data, obj)
CampaignObject.LoadFirstPriorityProps(self, prop_data, obj)
-- sector_id used when finding the intel template
local idx = table.find(prop_data, "sector_id")
if idx then
obj.sector_id = prop_data[idx + 1]
end
end,
}),
})
PlaceObj('ClassDef', {
DefParentClassList = {
"CampaignObject",
},
group = "Satellite View",
id = "SatelliteSector",
PlaceObj('ClassMethodDef', {
'name', "GetError",
'code', function (self)
local errors = {}
if self.Guardpost and not next(self.EnemySquadsList) then
table.insert(errors, string.format("%s: Please select at least one enemy squad for guardpost", self.Id))
elseif self.Guardpost then
for _, squad in ipairs(self.EnemySquadsList) do
if squad == "" then
table.insert(errors, string.format("Please remove empty entries from guardpost enemy squads", self.Id))
break
end
end
end
local radios = Presets.RadioStationPreset["Default"]
if not radios[self.MusicCombat] then
table.insert(errors, string.format("%s: '%s' Music Combat radio station is invalid!", self.Id, self.MusicCombat))
end
if not radios[self.MusicConflict] then
table.insert(errors, string.format("%s: '%s' Music Conflict radio station is invalid!", self.Id, self.MusicConflict))
end
if not radios[self.MusicExploration] then
table.insert(errors, string.format("%s: '%s' Music Exploration radio station is invalid!", self.Id, self.MusicExploration))
end
local mapdata = MapData[self.Map]
local region = mapdata and mapdata.Region
if region and GameStateDefs[region].WeatherCycle and not self.WeatherZone then
table.insert(errors, string.format("Sectors from region %s need to have WeatherZone defined", region))
end
return next(errors) and table.concat(errors, "\n") or nil
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "SetId",
'no_edit', true,
'params', "self, id",
'default', function (self, id)
if self.modId then return end
self.name = id
CampaignObject.SetId(self, id)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "OnEditorNew",
'params', "parent, ged, is_paste",
'code', function (self, parent, ged, is_paste)
if parent.mod and IsKindOf(parent, "ModItemSector") then
self.Id = parent.sectorId
self.Map = parent:GetMapName()
self.modId = parent.mod.id
self.bidirectionalRoadApply = true
self.bidirectionalBlockApply = true
parent.SatelliteSectorObj = self
parent:PostLoad()
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "Setdisplay_name",
'no_edit', true,
'params', "self, display_name",
'default', function (self, display_name)
self.display_name = display_name
if self.modId then return end
if display_name then
self.name = string.format("%s %s", self.Id, _InternalTranslate(display_name))
else
self.name = self.Id
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "OnEditorSetProperty",
'no_edit', true,
'params', "self, prop_id",
'default', function (self, prop_id)
if not self.modId and prop_id == "Roads" or prop_id == "BlockTravel" then
SatelliteSectorSetDirectionsProp(self, prop_id)
end
if g_SatelliteUI then
g_SatelliteUI:UpdateSectorVisuals(self.Id)
end
if prop_id == "WeatherZone" then
g_WeatherZones = false
end
end,
}),
PlaceObj('PropertyDefHelp', {
'category', "Data",
'id', "generated_hint",
'help', "<center>This is an automatically-generated empty sector.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.generated end,
}),
PlaceObj('PropertyDefHelp', {
'category', "Data",
'id', "inherited_hint",
'help', "<center>This is an inherited sector - use the button below to override it in this DLC.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.inherited end,
}),
PlaceObj('PropertyDefButtons', {
'category', "Data",
'id', "edit_sector_button",
'buttons', {
PlaceObj('PropertyDefPropButton', {
'Name', "Edit sector",
'FuncName', "EditGeneratedSector",
'IsHidden', function (self)
if self.modId or config.ModdingToolsInUserMode then return true end
return IsKindOf(self, "GedMultiSelectAdapter") or not self.inherited and not self.generated
end,
}),
},
}),
PlaceObj('ClassMethodDef', {
'name', "EditGeneratedSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
self.inherited = nil
self.generated = nil
ObjModified(self)
ged:SetUiStatus("editing_sector", "Editing sector...")
if g_SatelliteUI then
g_SatelliteUI:RebuildSectorGrid()
end
ged:SetUiStatus("editing_sector")
end,
}),
PlaceObj('PropertyDefText', {
'id', "Id",
'name', "",
'help', "",
'read_only', true,
'translate', false,
}),
PlaceObj('ClassConstDef', {
'name', "EditorView",
'type', "translate",
'value', T(153688941226, --[[ClassDef Satellite View SatelliteSector value]] "<if_any(inherited,generated)><color 128 128 128></if><Id><opt(u(display_name),' ','')><if(inherited)> [inherited]</if><if(generated)> [generated - empty]</if>"),
'untranslated', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Underground",
'id', "HideUnderground",
'name', "Hide underground",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return self.GroundSector end,
}),
PlaceObj('PropertyDefBool', {
'category', "Underground",
'id', "CanGoUp",
'name', "Can go overground",
'help', "Whether this underground sector has a travel connection to its overground sector.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.GroundSector end,
'default', true,
}),
PlaceObj('PropertyDefButtons', {
'category', "Underground",
'id', "underground_sector_buttons",
'buttons', {
PlaceObj('PropertyDefPropButton', {
'Name', "Add underground sector",
'FuncName', "AddUndergroundSector",
'IsHidden', function (self)
if IsKindOf(self, "GedMultiSelectAdapter") then return true end
if self.modId or config.ModdingToolsInUserMode then return true end
local campaign = GetParentTableOfKind(self, "CampaignPreset")
return not self.Id or
self.Id:ends_with("_Underground") or
(campaign and table.find(campaign.Sectors, "Id", self.Id .. "_Underground"))
end,
}),
PlaceObj('PropertyDefPropButton', {
'Name', "Select underground sector",
'FuncName', "SelectUndergroundSector",
'IsHidden', function (self)
if IsKindOf(self, "GedMultiSelectAdapter") then return true end
if self.modId or config.ModdingToolsInUserMode then return true end
local campaign = GetParentTableOfKind(self, "CampaignPreset")
return not self.Id or
self.Id:ends_with("_Underground") or
not (campaign and table.find(campaign.Sectors, "Id", self.Id .. "_Underground"))
end,
}),
PlaceObj('PropertyDefPropButton', {
'Name', "Remove sector",
'FuncName', "RemoveSector",
'IsHidden', function (self)
if self.modId or config.ModdingToolsInUserMode then return true end
return IsKindOf(self, "GedMultiSelectAdapter") or not self.Id or self.inherited or not self.Id:ends_with("_Underground")
end,
}),
},
}),
PlaceObj('ClassMethodDef', {
'name', "AddUndergroundSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
CreateRealTimeThread(function()
local id = self.Id .. "_Underground"
local sector = PlaceObject("SatelliteSector")
sector.GroundSector = self.Id
sector:SetId(id)
local sectors = GetParentTable(self)
local idx = table.find(sectors, "Id", self.Id) + 1
table.insert(sectors, idx, sector)
UpdateParentTable(sector, sectors)
ged:SetUiStatus("add_sector", "Adding sector...")
CreateSessionCampaignObject(sector, SatelliteSector, gv_Sectors, "Sectors")
if g_SatelliteUI then
g_SatelliteUI:RebuildSectorGrid()
end
ObjModified(sectors)
Sleep(100)
ged:SetSelection("root", { idx }, nil, "notify")
ged:SetUiStatus("add_sector")
end)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "SelectUndergroundSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
CreateRealTimeThread(function()
ged:ResetFilter("root")
Sleep(100)
ged:SetSelection("root", { table.find(GetParentTable(self), "Id", self.Id .. "_Underground") }, nil, "notify")
end)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "RemoveSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
CreateRealTimeThread(function()
local sectors = GetParentTable(self)
table.remove_value(sectors, self)
GetParentTableOfKind(self, "CampaignPreset"):PostLoad() -- rerun sector inheritance
if not table.find(sectors, "Id", self.Id) then
DeleteSessionCampaignObject(self, SatelliteSector, gv_Sectors)
end
ged:SetUiStatus("remove_sector", "Removing sector...")
if g_SatelliteUI then
g_SatelliteUI:RebuildSectorGrid()
end
ObjModified(sectors)
Sleep(100)
ged:SetSelection("root", { table.find(GetParentTable(self), "Id", self.Id:gsub("_Underground", "")) }, nil, "notify")
ged:SetUiStatus("remove_sector")
end)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "GenerateDBCacheStatic",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
GenerateDynamicDBPathCache("save", ged)
end,
}),
PlaceObj('PropertyDefPoint', {
'id', "MapPosition",
'help', "delete me",
'dont_save', true,
'no_edit', true,
}),
PlaceObj('PropertyDefPoint', {
'id', "XMapPosition",
'no_edit', true,
}),
PlaceObj('PropertyDefPoint', {
'id', "IconMapPosition",
'dont_save', true,
'no_edit', true,
}),
PlaceObj('PropertyDefCombo', {
'id', "Map",
'name', "Map",
'items', function (self) return ListMaps() end,
}),
PlaceObj('PropertyDefNumber', {
'id', "MapTier",
'name', "Tier",
'help', "Used in the 'PlayerIsInSectorsOfTier' conditional effect to, for example, spawn loot on the map.",
'default', 0,
'scale', 10,
'step', 5,
'min', 0,
'max', 50,
}),
PlaceObj('PropertyDefText', {
'id', "Label1",
'name', "Label 1",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return config.ModdingToolsInUserMode end,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "modId",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "Label2",
'name', "Label 2",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return config.ModdingToolsInUserMode end,
'translate', false,
}),
PlaceObj('PropertyDefBool', {
'id', "RunLoyaltyLogic",
'name', "Run loyalty logic",
'help', "Whether this sector will grant/remove loyalty on conflict resolution",
'default', true,
}),
PlaceObj('PropertyDefText', {
'id', "GroundSector",
'help', "",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "template_key",
'help', "",
'read_only', true,
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "display_name",
'name', "Display name",
'context', "SatelliteSectorLocContext()",
}),
PlaceObj('PropertyDefCombo', {
'id', "Side",
'default', "enemy1",
'items', function (self) return Sides end,
}),
PlaceObj('PropertyDefBool', {
'id', "StickySide",
'name', "Sticky side",
'help', "Prevents changing the side of the sector unless it is forced from a conditinal effect or 'SatelliteSectorSetSide' with 'force' param.",
}),
PlaceObj('PropertyDefPresetId', {
'category', "Travel",
'id', "TerrainType",
'name', "Terrain type",
'help', "Terrain type modifies the travel time",
'extra_code', "no_edit = function(self) return self.GroundSector end",
'preset_class', "SectorTerrain",
'default', "Savanna",
}),
PlaceObj('PropertyDefCombo', {
'id', "WeatherZone",
'name', "Weather zone",
'help', "Weather Zone the sector belongs to. Sectors within the same Weather Zone have the same weather cycle.",
'default', "Default",
'items', function (self)
local campaignPreset
if self.modId then
local modItem = GetParentTableOfKind(self, "ModItemSector")
campaignPreset = modItem and CampaignPresets[modItem.campaignId]
else
campaignPreset = GetCurrentCampaignPreset()
end
return campaignPreset and WeatherZoneCombo(campaignPreset) or {}
end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Travel",
'id', "Passability",
'extra_code', "no_edit = function(self) return self.GroundSector end",
'default', "Land",
'items', function (self) return {"Land", "Water", "Land and Water", "Blocked"} end,
}),
PlaceObj('PropertyDefCombo', {
'category', "City",
'id', "City",
'name', "Associated city",
'default', "none",
'items', function (self) return table.iappend({"none"}, table.map(GetCurrentCampaignPreset().Cities, "Id")) end,
}),
PlaceObj('PropertyDefBool', {
'category', "City",
'id', "ShowCity",
'name', "Show city name",
'help', "Whether to show the city name on the sector",
}),
PlaceObj('PropertyDefBool', {
'id', "reveal_allowed",
'help', "This sector can be revealed by the player, and traits on them are shown in the satellite view. At the start of the campaign mainland sectors are not visible.",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "never_autoresolve",
'name', "Never autoresolve",
'help', "Conflicts on this sector can never be autoresolved",
}),
PlaceObj('PropertyDefBool', {
'id', "discovered",
'name', "Discovered",
'help', "The player has been to this sector, or has started travelling to it via some method. In use only for underground sectors.",
'default', true,
}),
PlaceObj('PropertyDefNumber', {
'category', "Conflict",
'id', "AutoResolveDefenderBonus",
'name', "AutoResolve defender bonus",
'help', "Percent by which defender power is increased in this sector",
'default', 0,
'min', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "Mine",
}),
PlaceObj('PropertyDefNumber', {
'category', "Mine",
'id', "DailyIncome",
'help', "Profit per day at 100% loyalty",
'extra_code', "no_edit = function(self) return not self.Mine end",
'default', 1000,
'min', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "intel_progress",
'name', "Intel progress",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "Depletion",
'extra_code', "no_edit = function(self) return not self.Mine end",
}),
PlaceObj('PropertyDefNumber', {
'category', "Mine",
'id', "DepletionTime",
'help', "In how many days the mine will deplete. This should be randomized each game around this value.",
'extra_code', "no_edit = function(self) return not self.Mine end",
'default', 90,
'min', 1,
'max', 500,
}),
PlaceObj('PropertyDefNumber', {
'category', "Mine",
'id', "mine_work_days",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "mine_depleted",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "mine_enabled",
'no_edit', true,
'default', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Mine",
'id', "income_mods",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Mine",
'id', "depletion_mods",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Hospital",
'id', "Hospital",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefBool', {
'category', "Hospital",
'id', "HospitalLocked",
'name', "Hospital locked",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefBool', {
'category', "Guardpost",
'id', "Guardpost",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefNumber', {
'category', "Guardpost",
'id', "PatrolRespawnTime",
'name', "Attack spawn (+24h preparation)",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'default', 172800,
'scale', "h",
'min', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Guardpost",
'id', "InitialSpawn",
'name', "Initial squad spawn",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
}),
PlaceObj('PropertyDefStringList', {
'category', "Guardpost",
'id', "TargetSectors",
'name', "Target sectors",
'help', "Target sectors for spawned enemy squads.",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'items', function (self) return GetCampaignSectorsCombo("") end,
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Guardpost",
'id', "ExtraDefenderSquads",
'name', "Extra defender squads",
'help', "Squads that will be spawned as extra defenders (4th shield)",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'preset_class', "EnemySquads",
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Guardpost",
'id', "EnemySquadsList",
'name', "Enemy squads list",
'help', "A random squad from the list will be chosen on guardpost spawn time",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'preset_class', "EnemySquads",
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Guardpost",
'id', "StrongEnemySquadsList",
'name', "Strong enemy squads list",
'help', 'When the guardpost performs a "strong attack" it will swap the currently primed squad with one from this array.',
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'preset_class', "EnemySquads",
}),
PlaceObj('PropertyDefBool', {
'category', "Militia",
'id', "Militia",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "MaxMilitia",
'extra_code', "no_edit = function(self) return not self.Militia end",
'default', 8,
'min', 1,
'max', 50,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "MilitiaTrainingCost",
'name', "Training cost",
'extra_code', "no_edit = function(self) return not self.Militia end",
'default', 750,
'min', 1,
'max', 10000,
}),
PlaceObj('PropertyDefBool', {
'category', "Conflict",
'id', "ForceConflict",
'name', "Force conflict",
}),
PlaceObj('PropertyDefStringList', {
'category', "Conflict",
'id', "InitialSquads",
'name', "Initial squads",
'items', function (self) return table.keys(EnemySquadDefs, true) end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Conflict",
'id', "CustomConflictDescr",
'name', "Custom conflict description",
'help', "The first time a conflict is initiated in this sector, this description preset will be shown.",
'items', function (self) return PresetGroupCombo("ConflictDescription", "Default") end,
}),
PlaceObj('PropertyDefBool', {
'category', "Militia",
'id', "militia_training",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "militia_training_progress",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "militia_squad_id",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "militia_training_payed_cost",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'category', "Operation",
'id', "training_stat",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefTable', {
'category', "Operation",
'id', "custom_operations",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Operation",
'id', "operations_temp_data",
'help', "Temp data for assigned mercs before the actual operation start/change. Valid only when the UI is opened in 'change' mode.",
'dont_save', true,
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Operation",
'id', "started_operations",
'help', "Started operations for the sector",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "Intel",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "intel_discovered",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "player_visited",
'help', "Marked as visited when a player squad reaches the sector's center on the satellite.",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "autoresolve_disabled",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "InterestingSector",
'name', "Interesting sector",
'help', "Will be listed as one after GatherIntel operation completes and will start voice responses if passed by.",
}),
PlaceObj('PropertyDefNumber', {
'id', "MinFlareCarriers",
'name', "Min flare carriers",
'help', "Minimum number of Roaming NPCs to carry a light during Night or Underground",
'default', 1,
'slider', true,
'min', 0,
'max', 20,
}),
PlaceObj('PropertyDefNumber', {
'id', "MaxFlareCarriers",
'name', "Max flare carriers",
'help', "Minimum number of Roaming NPCs to carry a light during Night or Underground",
'default', 3,
'slider', true,
'min', 0,
'max', 20,
'custom_min', function (self) return self.MinFlareCarriers end,
'custom_max', function (self) return 20 end,
'custom_lims', true,
}),
PlaceObj('PropertyDefBool', {
'id', "RAndRAllowed",
'name', "R&R allowed",
'help', "R&R operation is available in this sector",
}),
PlaceObj('PropertyDefBool', {
'id', "RepairShop",
'name', "Repair shop",
'help', "Allows Craft Ammo, Craft Explosives operations in this sector",
}),
PlaceObj('PropertyDefBool', {
'category', "Travel",
'id', "bidirectionalRoadApply",
'name', "Apply roads to adjacent sectors",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.modId end,
}),
PlaceObj('PropertyDefDirectionsSet', {
'category', "Travel",
'id', "Roads",
'name', "Roads",
'help', "Roads only improve the quality of travel and lack of a road doesn't prevent travel between sectors",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefBool', {
'category', "Travel",
'id', "ImpassableForEnemies",
'name', "Impassable for enemies",
'help', "Enemy squads can't pass through this sector",
}),
PlaceObj('PropertyDefBool', {
'category', "Diamond Briefcase",
'id', "ImpassableForDiamonds",
'name', "Impassable for diamonds",
'help', "Diamond shipments can't pass through this sector",
}),
PlaceObj('PropertyDefBool', {
'category', "Travel",
'id', "bidirectionalBlockApply",
'name', "Apply block travel to adjacent sectors",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.modId end,
}),
PlaceObj('PropertyDefDirectionsSet', {
'category', "Travel",
'id', "BlockTravel",
'name', "Block travel",
'help', "Blocks travel and adds ui indication for that in the satellite view (red/white line)",
}),
PlaceObj('PropertyDefDirectionsSet', {
'category', "Travel",
'id', "BlockTravelRiver",
'name', "Block travel - invisible",
'help', "Blocks travel without displaying it on the sat view",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefText', {
'id', "sector_data",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefNestedList', {
'id', "dead_units",
'help', "All dead units on the map before removing and converting them to bags. Used for adding their staff to the stash",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_inventory",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_repair_items",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_repair_items_queued",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_craft_ammo_items_queued",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_craft_explosive_items_queued",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefTable', {
'id', "conflict",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'id', "conflict_backup",
'no_edit', true,
}),
PlaceObj('PropertyDefNestedObj', {
'id', "guardpost_obj",
'no_edit', true,
'base_class', "GuardpostSessionObject",
}),
PlaceObj('PropertyDefUIImage', {
'id', "image",
'name', "Image",
'default', "UI/SatelliteView/SectorImages/_Highlands",
'image_preview_size', 200,
}),
PlaceObj('PropertyDefUIImage', {
'id', "override_loading_screen",
'no_edit', true,
'image_preview_size', 200,
}),
PlaceObj('PropertyDefNestedList', {
'category', "Events",
'id', "Events",
'base_class', "SectorEvent",
}),
PlaceObj('PropertyDefTable', {
'id', "ExecutedEvents",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Port",
'id', "Port",
'name', "Port",
}),
PlaceObj('PropertyDefBool', {
'category', "Port",
'id', "PortLocked",
'name', "Port locked",
}),
PlaceObj('PropertyDefBool', {
'category', "Port",
'id', "CanBeUsedForArrival",
'name', "Can be used for arrival",
}),
PlaceObj('PropertyDefNumber', {
'category', "Port",
'id', "BobbyRayDeliveryCostMultiplier",
'name', "Bobby Ray delivery cost multiplier",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.CanBeUsedForArrival end,
'default', 100,
'scale', "%",
}),
PlaceObj('PropertyDefUIImage', {
'category', "Port",
'id', "SectorImagePreview",
'name', "Sector image preview",
'no_edit', "BobbyRayDeliveryCostMultiplier.no_edit",
'default', "UI/PDA/ss_i1.png",
}),
PlaceObj('PropertyDefBool', {
'category', "Diamond Briefcase",
'id', "DBSourceSector",
'name', "Source sector",
'help', "Travelling squads carrying diamond shipments will spawn on this sector.",
}),
PlaceObj('PropertyDefBool', {
'category', "Diamond Briefcase",
'id', "DBDestinationSector",
'name', "Destination sector",
'help', "Travelling squads carrying diamond shipments will path to this sector.",
}),
PlaceObj('PropertyDefButtons', {
'category', "Diamond Briefcase",
'id', "DBRecalc",
'help', "You only need to run this once when applying multiple changes. It will take a while!",
'buttons', {
PlaceObj('PropertyDefPropButton', {
'Name', "Recalculate Diamond Routes",
'FuncName', "GenerateDBCacheStatic",
'IsHidden', function (self) return config.ModdingToolsInUserMode end,
}),
},
}),
PlaceObj('PropertyDefNumber', {
'category', "Port",
'id', "PricePerTile",
'name', "Price per tile",
}),
PlaceObj('ClassMethodDef', {
'name', "GetTravelPrice",
'params', "squad",
'code', function (self, squad)
local cost = self.PricePerTile or const.Satellite.DefaultPortPricePerTile
local discounts = false
local cityHere = gv_Cities[self.City]
if cityHere and cityHere.Loyalty > 0 then
local discount = Lerp(0, 50, cityHere.Loyalty, 100)
cost = cost - MulDivRound(cost, discount, 100)
if not discounts then discounts = {} end
discounts[#discounts + 1] = {
label = T(342530626078, "Loyalty"),
percent = discount
}
end
if IsKindOf(squad, "SatelliteSquad") then
for _, id in ipairs(squad.units) do
local unit = gv_UnitData[id]
if HasPerk(unit, "Negotiator") then
local discount = CharacterEffectDefs.Negotiator:ResolveValue("discountPercent")
if not discounts then discounts = {} end
discounts[#discounts + 1] = {
label = T{542222741234, "<Nick> <em>(<perkName>)</em>", Nick = unit.Nick, perkName = CharacterEffectDefs.Negotiator.DisplayName},
percent = discount,
}
cost = cost - MulDivRound(cost, discount, 100)
break
end
end
end
return cost, discounts
end,
}),
PlaceObj('PropertyDefBool', {
'id', "enabled_auto_deploy",
'no_edit', true,
'default', true,
}),
PlaceObj('PropertyDefChoice', {
'id', "awareness_sequence",
'name', "Awareness sequence",
'default', "Standard",
'items', function (self) return { "Standard", "Skip Setpiece", "Skip All" } end,
}),
PlaceObj('PropertyDefNumber', {
'id', "last_enter_campaign_time",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "last_own_campaign_time",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefCombo', {
'category', "Music",
'id', "MusicCombat",
'name', "Music combat",
'help', "Music in turn based mode",
'default', "Battle_Easy",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Music",
'id', "MusicConflict",
'name', "Music conflict",
'help', "In real time exploration but the sector is still in conflict",
'default', "Village_Conflict",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Music",
'id', "MusicExploration",
'name', "Music exploration",
'help', "Real time exploration and there is no conflict in the sector",
'default', "Jungle_Exploration",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('ClassConstDef', {
'name', "FilterClass",
'type', "text",
'value', "SatelliteSectorGedFilter",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "enemy_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "ally_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "underground_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "ally_and_militia_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "all_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefBool', {
'category', "Warning State",
'id', "warningStateEnabled",
'name', "Enable warning state",
'help', "If enabled the first time you are discovered by enemies you will enter a Warning State.\nA timer is set. Enemies become neutral until the timer expires. And effects can be executed.",
}),
PlaceObj('PropertyDefBool', {
'category', "Warning State",
'id', "warningReceived",
'name', "Warning received",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Warning State",
'id', "inWarningState",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'category', "Warning State",
'id', "warningTimerText",
'name', "Warning timer text",
'help', "Text to display when the Warning State is active.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.warningStateEnabled end,
'default', T(888882045986, --[[ClassDef Satellite View SatelliteSector default]] "Exit the Area"),
}),
PlaceObj('PropertyDefNumber', {
'category', "Warning State",
'id', "warningStateTimer",
'name', "Warning state timer",
'help', "How long (sec) will the Warning State hold.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.warningStateEnabled end,
'default', 30000,
'scale', "sec",
'min', 0,
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Warning State",
'id', "warningBanters",
'name', "Warning banters",
'help', "List of banters from which to choose one to play when spotted by the nearest enemy.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.warningStateEnabled end,
'preset_class', "BanterDef",
}),
PlaceObj('PropertyDefChoice', {
'category', "Combat Tasks",
'id', "combatTaskGenerate",
'name', "When to generate",
'help', "When to generate Combat Tasks. Chances and cooldowns are independant and are always taken into account.",
'default', "always",
'items', function (self) return {"always", "afterFirstConflict", "never"} end,
}),
PlaceObj('PropertyDefNumber', {
'category', "Combat Tasks",
'id', "combatTaskAmount",
'name', "Maximum amount",
'help', "Maximum Combat Tasks that can be given.",
'default', 1,
'min', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Combat Tasks",
'id', "firstConflictWon",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "conflictLoyaltyGained",
'help', "Checks whether to give loyalty on Conflict Win. Resets on sector lost and sector defended.",
'no_edit', true,
}),
PlaceObj('ClassConstDef', {
'name', "generated",
}),
PlaceObj('ClassConstDef', {
'name', "inherited",
}),
PlaceObj('ClassMethodDef', {
'name', "IsReadOnly",
'comment', "for GED",
'code', function (self)
return self.generated or self.inherited or (config.ModdingToolsInUserMode and not self.modId)
end,
}),
})
PlaceObj('ClassDef', {
Comment = "Support class for filtering in the satellite sector editor",
DefParentClassList = {
"GedFilter",
},
group = "Satellite View",
id = "SatelliteSectorGedFilter",
PlaceObj('ClassMethodDef', {
'name', "FilterObject",
'params', "sector",
'code', function (self, sector)
if self.HideGenerated and (sector.inherited or sector.generated) then return false end
if self.Mine ~= "don't care" and self.Mine ~= sector.Mine then return false end
if self.Guardpost ~= "don't care" and self.Guardpost ~= sector.Guardpost then return false end
if self.City == "any" then
if sector.City == "none" then return false end
elseif self.City ~= "don't care" and self.City ~= sector.City then return false end
if self.Events ~= "don't care" and self.Events ~= (sector.Events and #sector.Events > 0) then return false end
if self.Region ~= "don't care" then
local region = sector.Map and MapData[sector.Map] and MapData[sector.Map].Region
if self.Region ~= region then return false end
end
if self.Port ~= "don't care" and self.Port ~= sector.Port then
return false
end
if self.Militia ~= "don't care" and self.Militia ~= sector.Militia then
return false
end
if self.Music then
local music_match
if sector.MusicCombat and string.match(sector.MusicCombat, self.Music) then
music_match = true
end
if sector.MusicConflict and string.match(sector.MusicConflict, self.Music) then
music_match = true
end
if sector.MusicExploration and string.match(sector.MusicExploration, self.Music) then
music_match = true
end
if not music_match then
return false
end
end
if self.Weather then
if not (sector.WeatherZone and string.match(string.lower(sector.WeatherZone), string.lower(self.Weather)) )then
return false
end
end
return true
end,
}),
PlaceObj('PropertyDefBool', {
'id', "HideGenerated",
'name', "Hide inherited/empty",
}),
PlaceObj('PropertyDefChoice', {
'id', "City",
'default', "don't care",
'items', function (self) return table.iappend({"don't care", "any", "none"}, table.map(GetCurrentCampaignPreset().Cities, "Id")) end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Mine",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Events",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Guardpost",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Region",
'default', "don't care",
'items', function (self) return PresetsCombo("GameStateDef", "region", "don't care") end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Port",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Militia",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Music",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('PropertyDefText', {
'id', "Weather",
'translate', false,
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "SatelliteSquad",
PlaceObj('PropertyDefCombo', {
'id', "Side",
'default', "enemy1",
'items', function (self) return Sides end,
}),
PlaceObj('PropertyDefText', {
'id', "Name",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "image",
'translate', false,
}),
PlaceObj('PropertyDefNumber', {
'id', "UniqueId",
}),
PlaceObj('PropertyDefCombo', {
'id', "CurrentSector",
'items', function (self) return GetCampaignSectorsCombo() end,
}),
PlaceObj('PropertyDefText', {
'id', "PreviousSector",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "PreviousLandSector",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefBool', {
'id', "Sleep",
}),
PlaceObj('PropertyDefBool', {
'id', "Retreat",
}),
PlaceObj('PropertyDefPoint', {
'id', "VisualPos",
}),
PlaceObj('PropertyDefPoint', {
'id', "XVisualPos",
}),
PlaceObj('PropertyDefTable', {
'id', "route",
}),
PlaceObj('PropertyDefTable', {
'id', "water_route",
}),
PlaceObj('PropertyDefBool', {
'id', "water_travel",
}),
PlaceObj('PropertyDefBool', {
'id', "returning_water_travel",
'help', "",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'id', "water_travel_rest_timer",
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "traversing_shortcut_start",
}),
PlaceObj('PropertyDefText', {
'id', "traversing_shortcut_start_sId",
}),
PlaceObj('PropertyDefBool', {
'id', "traversing_shortcut_water",
'help', "",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "uninterruptable_travel",
'help', "",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'id', "joining_squad",
}),
PlaceObj('PropertyDefTable', {
'id', "units",
}),
PlaceObj('PropertyDefBool', {
'id', "militia",
'help', "Militia squad",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "arrival_squad",
'help', "Squad not on the map yet",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "diamond_briefcase",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'id', "shipment_preset_id",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "guardpost",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "diamond_briefcase_dynamic",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "always_visible",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "villain",
'help', "Villain squad",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "ref",
'help', "Used by UI in objects which pretend to be squads, because of duck typing it needs to be in the squad definition as well",
'dont_save', true,
'read_only', true,
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'id', "enemy_squad_def",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefNumber', {
'id', "wait_in_sector",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'id', "arrive_in_sector",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'id', "vrForActivity",
}),
PlaceObj('PropertyDefNestedList', {
'id', "squad_bag",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('ClassMethodDef', {
'name', "CancelTravel",
'code', function (self)
NetSyncEvent("SquadCancelTravel", self.UniqueId)
end,
}),
PlaceObj('PropertyDefText', {
'id', "on_reach_quest",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefTable', {
'id', "on_reach_var",
'no_edit', true,
}),
})
PlaceObj('PresetDef', {
DefEditorIcon = "CommonAssets/UI/Icons/location marker pin.png",
DefEditorMenubar = "Scripting",
DefEditorMenubarSortKey = "4500",
DefEditorName = "Sector Operations",
DefGlobalMap = "SectorOperations",
DefHasParameters = true,
DefHasSortKey = true,
DefModItem = true,
DefModItemName = "Sector operation",
DefModItemSubmenu = "Campaign & Maps",
DefParentClassList = {
"Preset",
"CampaignSpecific",
},
group = "Satellite View",
id = "SectorOperation",
PlaceObj('PropertyDefBool', {
'id', "Custom",
'help', "Custom operations show only certain properties",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "CustomRepeat",
'name', "Repeat",
'help', "Operation reamains enabled on completion and can be performed again",
'extra_code', "no_edit = function(self) return not self.Custom end",
}),
PlaceObj('PropertyDefSet', {
'id', "operation_type",
'name', "Type",
'help', "Operation categories by action",
'items', function (self) return {"Healing"} end,
}),
PlaceObj('PropertyDefText', {
'id', "display_name",
'name', "Display name",
}),
PlaceObj('PropertyDefText', {
'id', "short_name",
'name', "Short Name",
'default', T(814680295449, --[[PresetDef SectorOperation default]] "Operation"),
}),
PlaceObj('PropertyDefText', {
'id', "sub_title",
'name', "Sub Title",
}),
PlaceObj('PropertyDefText', {
'id', "progress_sub_title",
'name', "Sub Title in Progress",
}),
PlaceObj('PropertyDefText', {
'id', "description",
'name', "Description",
}),
PlaceObj('PropertyDefText', {
'id', "log_msg_start",
'name', "LogMsgOnStart",
'help', "Log message on operation start",
'default', "",
}),
PlaceObj('PropertyDefUIImage', {
'id', "image",
'name', "Image",
}),
PlaceObj('PropertyDefUIImage', {
'id', "icon",
'name', "Icon",
'help', "Satellite view on-screen merc icon",
}),
PlaceObj('PropertyDefNestedList', {
'id', "Professions",
'base_class', "SectorOperationProfession",
'auto_expand', true,
}),
PlaceObj('PropertyDefBool', {
'id', "ShowInCombatBadge",
'help', "Show in Combat Badge",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "ShowPauseProgress",
'help', "Show saved operation progress when no mercs are attached",
}),
PlaceObj('PropertyDefText', {
'id', "error_msg",
'name', "ErrorMessage",
}),
PlaceObj('PropertyDefCombo', {
'id', "RequiredItem",
'name', "Required Item",
'items', function (self) return table.keys2(InventoryItemDefs, "sorted", "") end,
}),
PlaceObj('PropertyDefStringList', {
'id', "RequiredResources",
'item_default', "Money",
'items', function (self)
local items = table.imap(SectorOperationResouces, "id")
table.sort(items)
return items
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetSectorSlots",
'help', "Maximum merc slots per profession for this operation in the sector",
'params', "self, prof, sector",
'default', function (self, prof, sector)
return 1
end,
}),
PlaceObj('PropertyDefCombo', {
'id', "related_stat",
'name', "Associated Stat",
'help', "Stat which is used to advance the operation per tick (50 for no selected stat)",
'items', function (self) return UnitPropertiesStats:GetProperties() end,
}),
PlaceObj('PropertyDefCombo', {
'id', "related_stat_2",
'name', "Second Associated Stat",
'help', "Between the two stats - the one with higher value is counted",
'items', function (self) return UnitPropertiesStats:GetProperties() end,
}),
PlaceObj('PropertyDefCombo', {
'id', "min_requirement_stat",
'name', "Min Requirement Stat",
'help', "Given Stat at given value required for mercs to be able to perform the operation",
'items', function (self) return UnitPropertiesStats:GetProperties() end,
}),
PlaceObj('PropertyDefNumber', {
'id', "min_requirement_stat_value",
'name', "Min Requirement Value",
'help', "Min value of the stat required for mercs to be able to perform the operation",
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "target_contribution",
'name', "Target Contribution",
'help', "Each tick the merc contributes his Associated Stat (or 50 if no stat is set) towards a value that has to reach Target Contribution to finish the Operation",
'default', 1000,
}),
PlaceObj('PropertyDefNumber', {
'id', "target_example",
'name', "Target Example Time",
'help', "The time (in hours) it would take for a full set of mercs with stat 100 to finish the operation.",
'dont_save', true,
'read_only', true,
'default', 1000,
}),
PlaceObj('ClassMethodDef', {
'name', "Gettarget_example",
'code', function (self)
return self.target_contribution / (4*self:GetSectorSlots()*100)
end,
}),
PlaceObj('PropertyDefNestedList', {
'id', "bonus_perks",
'name', "Bonus Perks",
'help', "Each perk provides additional contribution",
'base_class', "SectorOperationBonusPerk",
'auto_expand', true,
}),
PlaceObj('PropertyDefFunc', {
'id', "Tick",
'name', "Tick",
'params', "self, merc",
'default', function (self, merc)
local sector = merc:GetSector()
local progress_per_tick = self:ProgressPerTick(merc)
if CheatEnabled("FastActivity") then
progress_per_tick = progress_per_tick*100
end
self:ModifyProgress(progress_per_tick, sector)
self:CheckCompleted(merc, sector)
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "SectorMercsTick",
'name', "SectorMercsTick",
'params', "self, merc",
}),
PlaceObj('PropertyDefFunc', {
'id', "CheckCompleted",
'params', "self, merc, sector",
'default', function (self, merc, sector)
if self:ProgressCurrent(merc, sector) >= self:ProgressCompleteThreshold(merc, sector) then
self:Complete(sector)
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "Complete",
'params', "self, sector",
'default', function (self, sector)
local mercs = GetOperationProfessionals(sector.Id, self.id)
local merc_names = {}
for _, merc in ipairs(mercs) do
merc_names[#merc_names + 1] = merc.Nick
merc:SetCurrentOperation("Idle")
end
self:OnComplete(sector, mercs)
if next(merc_names) then
CombatLog("important", T{352089713704, "<em><mercs></em> finished <em><activity></em> in <SectorName(sector)>", mercs = ConcatListWithAnd(merc_names),activity = self.display_name, sector = sector})
end
Msg("OperationCompleted", self, mercs, sector)
end,
}),
PlaceObj('ClassConstDef', {
'name', "Documentation",
'type', "text",
'value', "Creates a new sector operation that could be accessed through the sector operation menu. Allows adding new quests along with setting up variables that are related to them.",
}),
PlaceObj('PropertyDefFunc', {
'id', "OnComplete",
'params', "self, sector, mercs",
'default', function (self, sector, mercs)
if self.Custom then
local ca = sector.custom_operations[self.id]
if not self.CustomRepeat then
ca.status = "completed"
else
ca.progress = 0
end
local script = ca.EffectsOnSuccess
if script then
ExecuteEffectList(script)
end
local loot_table = ca.LootTableId
if loot_table then
local apply = ca.GrantItemApply
local units= apply=="all" and mercs or {mercs[1]}
for _, unit in ipairs(units) do
local items = {}
local loot_tbl = LootDefs[loot_table]
if loot_tbl then
loot_tbl:GenerateLoot(self, {}, unit:Random(), items)
--self.GrantedItemsTextUI = GetItemsNamesText(items)
local squad = unit.Squad
local all_squad_mercs = gv_Squads[squad].units
AddItemsToSquadBag(unit.Squad, items)
if #items>0 then
unit:AddItemsToInventory(items)
end
if #items>0 then
--give to all mercs from the squad
for idx, merc in ipairs(all_squad_mercs) do
if #items<=0 then break end
local u = gv_UnitData[merc]
u:AddItemsToInventory(items)
end
end
if #items > 0 then
local stash = GetSectorInventory(sector.Id)
if stash then
AddItemsToInventory(stash, items, true)
end
end
if #items>0 then
CombatLog("important", T{825769344536, "Inventory full. <name> can not grant all items", name = unit:GetDisplayName()})
end
end
end
end
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ProgressPerTick",
'name', "ProgressPerTick",
'params', "self, merc, prediction",
'default', function (self, merc, prediction)
if self.Custom then
local bonus = 0
local perks = self.bonus_perks
for _, bp in ipairs(self.bonus_perks or empty_table) do
if HasPerk(merc, bp.perk) then
bonus = bonus + bp.bonus
end
end
local _, val = self:GetRelatedStat(merc)
return (val or 50) + bonus
end
return 0
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ProgressCompleteThreshold",
'params', "self, merc, sector, prediction",
'default', function (self, merc, sector, prediction)
if self.Custom then
return self.target_contribution
end
return 0
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ProgressCurrent",
'params', "self, merc, sector, prediction",
'default', function (self, merc, sector, prediction)
return self.Custom and sector.custom_operations and sector.custom_operations[self.id] and sector.custom_operations[self.id].progress or -1
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "OnSetOperation",
'name', "OnSetOperation",
'params', "self, merc, arg",
}),
PlaceObj('PropertyDefFunc', {
'id', "OnRemoveOperation",
'name', "OnRemoveOperation",
'params', "self, merc",
}),
PlaceObj('PropertyDefFunc', {
'id', "OnMove",
'name', "OnMove",
'params', "self, merc,already_synced",
'default', function (self, merc,already_synced)
local operation_id = self.id
if operation_id== "Traveling" or operation_id == "Idle" or operation_id== "Arriving" then
return
end
local sector = merc:GetSector()
local mercs = GetOperationProfessionals(sector.Id, operation_id,false, merc.session_id)
if #mercs<=0 then
if already_synced then
local event_id = GetOperationEventId(merc, operation_id)
RemoveTimelineEvent(event_id)
NetSyncEvents.InterruptSectorOperation(sector.Id,operation_id)
else
NetSyncEvent("InterruptSectorOperation", sector.Id,operation_id)
end
Msg("OperationCompleted", SectorOperations[operation_id], mercs, sector)
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetOperationCost",
'params', "self, merc, profession, idx",
'default', function (self, merc, profession, idx)
return {}
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "FilterAvailable",
'params', "self, merc, profession",
'default', function (self, merc, profession)
return not self.min_requirement_stat or merc[self.min_requirement_stat] >= self.min_requirement_stat_value
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "CanPerformOperation",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc, profession",
'default', function (self, merc, profession)
return self:CanPerformOperationBase(merc, profession)
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "CanPerformOperationBase",
'no_edit', true,
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc, profession",
'default', function (self, merc, profession)
local cost = self:GetOperationCost(merc, profession)
if not CanPayOperation(cost, merc:GetSector()) then
return "OperationResourceError", {activity = self.display_name}
elseif merc:IsTravelling() then
return "OperationTravelError", {activity = self.display_name}
elseif self.RequiredItem and not merc:HasItem(self.RequiredItem) then
return "OperationMissingItemError", {activity = self.display_name, item = InventoryItemDefs[self.RequiredItem].DisplayName}
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "HasOperation",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, sector",
'default', function (self, sector)
if self.Custom then
return sector.custom_operations and sector.custom_operations[self.id] and
sector.custom_operations[self.id].status == "enabled"
end
return true
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "IsEnabled",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, sector",
'default', function (self, sector)
return true
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetDescription",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc",
'default', function (self, merc)
return self.description
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetTimelineEventDescription",
'params', "self, sector_id, eventcontext",
'default', function (self, sector_id, eventcontext)
local mercs
local professionId = self.Professions and self.Professions[1] and self.Professions[1].id
if eventcontext.mercs then
mercs = table.map(eventcontext.mercs, function(id) return gv_UnitData[id].Nick end)
else
mercs = GetOperationProfessionalsGroupedByProfession(sector_id, self.id)
mercs = table.map(professionId and mercs[professionId] or mercs, "Nick")
end
mercs = ConcatListWithAnd(mercs)
return T{366696912627, "<em><mercs></em> will finish <activityName>.", mercs = mercs, activityName = self.display_name}
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetAssignMessage",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, nameCombination, costTexts",
'default', function (self, nameCombination, costTexts)
costTexts = T(210127148759, "<newline>It will cost ") .. table.concat(costTexts, T(642697486575, ", ")) .. T(194271688304, ".")
return T{810287359580, "Do you want to assign mercs - <names> to this Operation? <costTexts>", names = nameCombination, costTexts = costTexts}
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "SectorOperationStats",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, sector, check_only",
'default', function (self, sector, check_only)
if self.Custom then
local lines = {}
if self.min_requirement_stat and self.min_requirement_stat_value then
local prop = table.find_value(UnitPropertiesStats:GetProperties(), "id", self.min_requirement_stat)
if check_only then return true end
lines[#lines + 1] = {text = T{300232421689, "Min Required <name>", name = prop.name}, value = T{139355455984, "<min_requirement_stat_value>",self}}
end
local progressVal = MulDivTrunc(self:ProgressCurrent(nil, sector) or 0, 100, self:ProgressCompleteThreshold(nil, sector))
if check_only then return true end
lines[#lines + 1] = {text = T(349715428104, "Current Progress"), value = T{257328164584, "<percent(value)>", value = progressVal}}
return lines, progressVal
end
return false, false
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetErrorMessage",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc",
'default', function (self, merc)
local genericError = self:CanPerformOperation(merc)
if genericError and self.error_msg then
return self.error_msg
end
if genericError == "OperationMissingItemError" then
return T{996660950207, "Missing required item <ItemName(RequiredItem)>.", self}
end
if genericError then
return Untranslated(genericError)
end
return false
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ModifyProgress",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, value, sector",
'default', function (self, value, sector)
if self.Custom then
local ac = sector.custom_operations and sector.custom_operations[self.id]
if ac then
ac.progress = ac.progress + value
end
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "BoostProgress",
'no_edit', true,
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, perc, sector",
'default', function (self, perc, sector)
local progress = self:ProgressCompleteThreshold(nil,sector) * perc / 100
self:ModifyProgress(Min(progress, self:ProgressCompleteThreshold(nil, sector) - self:ProgressCurrent(nil, sector)), sector)
ObjModified(sector)
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetRelatedStat",
'params', "self, merc, sector",
'default', function (self, merc, sector)
local stat1 = self.related_stat
local stat2 = self.related_stat_2
if stat1 or stat2 then
local stat = stat1
if not stat1 or (stat2 and merc[stat2] > merc[stat1]) then
stat = stat2
end
return stat, merc[stat]
end
end,
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "SectorOperationBonusPerk",
PlaceObj('PropertyDefPresetId', {
'id', "perk",
'name', "Perk",
'help', "Mercs with this perk provide bonus contribution per tick",
'preset_class', "CharacterEffectCompositeDef",
'preset_filter', function (preset, obj, prop_meta)
return preset.object_class == "Perk"
end,
}),
PlaceObj('PropertyDefNumber', {
'id', "bonus",
'name', "Bonus",
'help', "Value of the bonus contribution per tick",
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "SectorOperationProfession",
PlaceObj('PropertyDefText', {
'id', "id",
'name', "Id",
'help', "Profession",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "display_name",
'name', "Display Name",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "description",
'name', "Description",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "display_name_all_caps",
'name', "Display Name All Caps",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "display_name_plural",
'name', "Display Name Plural",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "display_name_plural_all_caps",
'name', "Display Name Plural All Caps",
'help', "Profession",
}),
})