User Tools

Site Tools


migration

This is an old revision of the document!


Migration Notes

Foundation 1.4

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:

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 }
    }
})

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: https://www.polymorph.games/foundation/modding/api/resource_type

Migration example:

mod:register({
    DataType = "RESOURCE",
    ...
 
--  OLD
--  ResourceType = "LUXURY_FOOD",
 
--  NEW
    ResourceTypeList = {
      "GRANARY",
      "TAVERN"
    }
 
    ...
})

Foundation 1.3.1.0802

Building Part Sets

In order to categorize the different parts of a building in the construction window, buildings and monuments now have building part sets.

For assets from type ASSET_BUILDING, the attribute BuildingPartList is now replaced with BuildingPartSetList (a list of BUILDING_PART_SET).

Migration example for the Example 02 mod:

monument.lua
mod:register({
    DataType = "MONUMENT",
    ...
 
--  Old
--  BuildingPartList = {
--      "MITHRIL_FACTORY_CORE_ROOT_PART",
--      "MITHRIL_FACTORY_EXTENSION_A_ROOT_PART",
--      "MITHRIL_FACTORY_EXTENSION_B_ROOT_PART",
--      "MITHRIL_FACTORY_DOOR_A_PART",
--      "MITHRIL_FACTORY_DOOR_B_PART",
--      "MITHRIL_FACTORY_DECORATION_A_PART",
--      "MITHRIL_FACTORY_DECORATION_B_PART"
--  },    
 
--  New
    BuildingPartSetList = {
        {
            Name = "PRODUCTION_CORE",
            BuildingPartList = {
                "MITHRIL_FACTORY_CORE_ROOT_PART"
            }
        },
        {
            Name = "PRODUCTION_EXTENSION",
            BuildingPartList = {
                "MITHRIL_FACTORY_EXTENSION_A_ROOT_PART",
                "MITHRIL_FACTORY_EXTENSION_B_ROOT_PART"
            }
        },
        {
            Name = "ENTRANCE",
            BuildingPartList = {
                "MITHRIL_FACTORY_DOOR_A_PART",
                "MITHRIL_FACTORY_DOOR_B_PART"
            }
        },
        {
            Name = "DECORATION",
            BuildingPartList = {
                "MITHRIL_FACTORY_DECORATION_A_PART",
                "MITHRIL_FACTORY_DECORATION_B_PART"
            }
        }
    },
 
    ...
})

Event Choices

The event assets have been reworked to give the possiblity to have multiple actions triggered when a choice is made. The class EVENT now has a new attribute ChoiceList (a list of EVENT_CHOICE), replacing the attribute ActionList.

Migration example for the Example 01 mod, where the action to give a quest has been replaced by a choice that gives two quests:

events.lua
myMod:register({
    DataType = "EVENT",
    ...
 
--  Old
--  ActionList = {
--      {
--          DataType = "EVENT_ACTION_GIVE_QUEST",
--          ShortName = "SUPER_EVENT_ACCEPT_QUEST",
--          Quest = "SUPER_QUEST"
--      },
--      {
--          DataType = "EVENT_ACTION_IGNORE",
--          ShortName = "KINGDOM_DECLINE",
--      }
--  },
 
--  New
    ChoiceList = {
        {
            ShortName = "EVENT_CHOICE_GIVE_TWO_QUESTS",
            EventActionList = {
                { DataType = "EVENT_ACTION_GIVE_QUEST", Quest = "SUPER_QUEST" },
                { DataType = "EVENT_ACTION_GIVE_QUEST", Quest = "GREAT_QUEST" }
            }
        },
        {
            ShortName = "KINGDOM_DECLINE",
            EventActionList = {
                { DataType = "EVENT_ACTION_IGNORE" }
            }
        },
    },
 
    ...
})

Foundation 1.2.2.3105

New mod.json

In order to only load mods when enabled, Foundation will now need a new description file for each mod. It will declare all the things Foundation would need to know about the mod without parsing the lua file.

mod.json
{
	"Name": "Simple Example Mod",
	"Author": "Leo",
	"Description": "A very simple mod example",
	"Version": "2.0.0",
 
	"AdditionalLanguageList": [
		{
			"Name": "Klingon",
			"Code": "tlh"
		}
	]
}

createMod() function is simplified

Since the new mod.json file already contains all basic information about the mod, the foundation.createMod() function does not take any parameter anymore.

mod.lua
local myMod = foundation.createMod()

GENERAL_DATA asset type has been removed

GENERAL_DATA asset type has been removed and all its properties has been moved to BALANCING.

However, modders can now partially override Foundation main balancing (DEFAULT_BALANCING), instead of being forced to replace all balancing properties. see Asset override for more information.

migration.1570055711.txt.gz · Last modified: 2019/10/02 18:35 by maxime

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki