User Tools

Site Tools


migration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
migration [2019/09/26 16:52] maximemigration [2020/05/22 12:12] maxime
Line 1: Line 1:
 ====== Migration Notes ====== ====== Migration Notes ======
 +
 +===== Foundation 1.6.0.0522 =====
 +
 +==== BUILDING and MONUMENT asset types ====
 +
 +Monuments have been reworked, and the ''MONUMENT'' type has been merged into ''[[api:building|BUILDING]]''. This means there are a few changes to the way buildings and monuments are created.
 +
 +=== Buildings ===
 +
 +A building's only building part should be specified with the property ''[[api:building#assetcorebuildingpart|AssetCoreBuildingPart]]'' instead of ''BuildingPartSetList''. For the game to not mistake a building for a monument, the property ''[[api:building#buildingpartsetlist|BuildingPartSetList]]'' shoud be left empty.
 +
 +<file lua>
 +local myBuilding = 
 +{
 +    DataType = "BUILDING",
 +    ...
 +}
 +
 +if (foundation.getGameVersion == nil or version.cmp(foundation.getGameVersion(), "1.6") < 0) then
 +    myBuilding.BuildingPartSetList = {
 +        {
 +            Name = "DEFAULT",
 +            BuildingPartList = { "CORE_BUILDING_PART" }
 +        }
 +    }
 +else
 +    myBuilding.AssetCoreBuildingPart = "CORE_BUILDING_PART"
 +end
 +
 +mod:register(myBuilding)
 +</file>
 +
 +=== Monuments ===
 +
 +Monuments are now created around a single building part, placed before all the others. This part is the one selected just after selecting the monument in the building selection menu. This part has to be specified in the property ''[[api:building#assetcorebuildingpart|AssetCoreBuildingPart]]''. All other parts still are in ''[[api:building#buildingpartsetlist|BuildingPartSetList]]''.
 +
 +The core building part, if removed, will remove the whole monument. Like for the market, the core building part can be used for preview only, and be invisible once built by setting ''[[api:building_part#isvisiblewhenbuild|BUILDING_PART.IsVisibleWhenBuilt]]'' to ''false''.
 +
 +<file lua>
 +local myMonument = {
 +    ...
 +}
 +
 +if (foundation.getGameVersion == nil or version.cmp(foundation.getGameVersion(), "1.6") < 0) then
 +    myMonument.DataType = "BUILDING",
 +    myMonument.BuildingPartSetList = {
 +    {
 +        Name = "DEFAULT",
 +        BuildingPartList = { "CORE_BUILDING_PART", "ADDITIONAL_PART_1", "ADDITIONAL_PART_2", "ADDITIONAL_PART_3" }
 +    }
 +else
 +    myMonument.DataType = "BUILDING",
 +    myMonument.AssetCoreBuildingPart = "CORE_BUILDING_PART",
 +    myMonument.BuildingPartSetList = {
 +    {
 +        Name = "DEFAULT",
 +        BuildingPartList = { "ADDITIONAL_PART_1", "ADDITIONAL_PART_2", "ADDITIONAL_PART_3" }
 +    }
 +end
 +
 +mod:register(myMonument)
 +</file>
 +
 +==== Bridge mover ====
 +
 +The way bridges are placed has been modified, and requires a small mover change. A bridge mover (''BUILDING_PART_MOVER_BRIDGE'') was previously needed on a bridge's root part, and on the end part.
 +
 +Now, to have a functional bridge, you need instead to place a bridge mover on the start part and end part, and remove the mover of the core part.
 +
 +Before:
 +  * CorePart - ''[[api:building_part_mover_bridge|BUILDING_PART_MOVER_BRIDGE]]''
 +    * StartPart - ''[[api:building_part_mover|BUILDING_PART_MOVER]]''
 +    * EndPart - ''[[api:building_part_mover_bridge|BUILDING_PART_MOVER_BRIDGE]]''
 +
 +Now:
 +  * CorePart - ''[[api:building_part_mover|BUILDING_PART_MOVER]]''
 +    * StartPart - ''[[api:building_part_mover_bridge|BUILDING_PART_MOVER_BRIDGE]]''
 +    * EndPart - ''[[api:building_part_mover_bridge|BUILDING_PART_MOVER_BRIDGE]]''
 +
 +==== Slope constructor ====
 +
 +Improvements have been made to the bridge, and you now have to setup bridge end parts (''StartPart'' and ''EndPart'') with a ''[[api:building_constructor_slope|BUILDING_CONSTRUCTOR_SLOPE]]''.
 +
 +==== Building zone and basement ====
 +
 +To improve the number of basement spawned, scalable building parts (with constructor ''[[api:building_constructor_scaler|BUILDING_CONSTRUCTOR_SCALER]]'' or ''[[api:building_constructor_basement|BUILDING_CONSTRUCTOR_BASEMENT]]'') now need a non-empty building zone that fits the size of your basement filler. If no building zone is set, basements will not be placed.
 +
 +===== Foundation 1.4.5.1009 =====
 +
 +==== Building Part Function ====
 +
 +For assets from type ''BUILDING_PART'', the attribute ''BuildingFunction'' is now replaced with ''AssetBuildingFunction''. Thus, the building function must now be declared as an asset of type ''BUILDING_FUNCTION''.
 +
 +Migration example for the //Example 02// mod:
 +<file lua building_parts.lua>
 +mod:register({
 +    DataType = "BUILDING_PART",
 +    ...
 +
 +--  OLD
 +--  BuildingFunction = { 
 +--      DataType = "BUILDING_FUNCTION_WORKPLACE",
 +--      WorkerCapacity = 4,
 +--      RelatedJob = { Job = "MITHRIL_MINER", Behavior = "WORK_BEHAVIOR" },
 +--      ResourceProduced = {
 +--          { Resource = "MITHRIL_ORE", Quantity = 5 }
 +--      }
 +--  },
 +
 +--  NEW
 +    BuildingFunction = "MITHRIL_MINE_FUNCTION",
 +
 +    ...
 +})
 +
 +-- ALSO NEW
 +mod:register({
 +    DataType = "BUILDING_FUNCTION_WORKPLACE",
 +    Id = "MITHRIL_MINE_FUNCTION",
 +    WorkerCapacity = 4,
 +    RelatedJob = { Job = "MITHRIL_MINER", Behavior = "WORK_BEHAVIOR" },
 +    ResourceProduced = {
 +        { Resource = "MITHRIL_ORE", Quantity = 5 }
 +    }
 +})
 +</file>
 +
 +==== Resource Type List ====
 +The enumeration ''RESOURCE_TYPE'' has been removed, and has been replaced by plain strings. This change means that modders can now define their own new types to work with their custom systems. The list of resource types has been moved to another page.
 +
 +Another change is that resource, markets, granaries and warehouses can now have multiple resource types. This, combined with new customizable resource types, will be useful to customize where resources can be stocked and sold. This means that the property ''ResourceType'' from ''RESOURCE'' has been renamed to ''ResourceTypeList''.
 +
 +For example, before this change, the wine was a resource of type ''LUXURY_FOOD''. Now, it has the types ''GRANARY'' and ''TAVERN''. The granary is configured to only store resources of type ''GRANARY'', and the tavern can only sell resources of type ''TAVERN''. Thus, wine will only be stored in granaries, and sold in taverns. The luxury stall, with its types ''LUXURY'' and ''LUXURY_FOOD'', will not be able to sell wine anymore.
 +
 +The complete list of core resource types can be found: [[api:resource_type|https://www.polymorph.games/foundation/modding/api/resource_type]]
 +
 +Migration example:
 +<file lua>
 +mod:register({
 +    DataType = "RESOURCE",
 +    ...
 +
 +--  OLD
 +--  ResourceType = "LUXURY_FOOD",
 +
 +--  NEW
 +    ResourceTypeList = {
 +      "GRANARY",
 +      "TAVERN"
 +    }
 +
 +    ...
 +})
 +</file>
  
 ===== Foundation 1.3.1.0802 ===== ===== Foundation 1.3.1.0802 =====
migration.txt · Last modified: 2023/09/05 11:21 by mathieu

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki