<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://medievalengineerswiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Deepflame</id>
	<title>Medieval Engineers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://medievalengineerswiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Deepflame"/>
	<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/w/Special:Contributions/Deepflame"/>
	<updated>2026-04-28T09:48:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Visual_Studio_Setup_Guide&amp;diff=12317</id>
		<title>Keen:Visual Studio Setup Guide</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Visual_Studio_Setup_Guide&amp;diff=12317"/>
		<updated>2018-03-09T13:49:36Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: Updating version string.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Version &amp;lt;!-- Do not change the version until the entire page is up-to-date --&amp;gt;&lt;br /&gt;
|release=0|major=6|minor=X|suppress=true}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This page will walk you through how to install and set up Visual Studio 2017 to start programming in Medieval Engineers whether it&#039;s an in-game script or a mod. In order to use the ME assemblies, we recommend Visual Studio 2017. There is a confirmed compiler crash in 2013 and we haven&#039;t tested 2015.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
You can get Visual Studio 2017 from http://www.visualstudio.com. The Community edition is free and is all you need to program in Medieval Engineers.&lt;br /&gt;
&lt;br /&gt;
When installing you should only need the .NET desktop development package.&lt;br /&gt;
&lt;br /&gt;
==Starting a Project==&lt;br /&gt;
Starting a Medieval Engineers scripting project in Visual Studio is pretty simple.&lt;br /&gt;
# Open Visual Studio and at the top left of the window click File &amp;gt; New &amp;gt; Project or press Ctrl + Shift + N.&lt;br /&gt;
# In the dialog that appears, find the C# templates and select the &amp;quot;Class Library (.NET Standard)&amp;quot; template. Name the project if you want to and click OK.&lt;br /&gt;
# In the solution explorer of VS, right-click the Project (ClassLibrary1 by default) &amp;gt; Add &amp;gt; Reference... and click Browse in the dialog that appears.&lt;br /&gt;
# Navigate to the Medieval Engineers - Mod SDK installation directory, which is usually [Steam installation directory]\steamapps\common\MedievalEngineersModSDK\OriginalContent\ModTools. If you don&#039;t have the Medieval Engineers - Mod SDK you can download it from Steam by going to Library &amp;gt; Tools.&lt;br /&gt;
# Click MedievalEngineersModAPI.dll and click Add. Make Sure its box is checked and click OK.&lt;br /&gt;
# In the solution explorer of VS, delete all references other than MedievalEngineersModAPI. We include a special subset of the default libraries, giving you all the whitelisted interfaces from there as well.&lt;br /&gt;
# If you are creating a mod, this is all the setup you need to do to start using the Mod API.&lt;br /&gt;
&lt;br /&gt;
If you have any existing projects you will want to remove all other assemblies and usings. We&#039;ve whitelisted many partial system classes in the game so it is best to use what is available in the MedievalEngineersModAPI.dll&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Research_Quests&amp;diff=7034</id>
		<title>Keen:Research Quests</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Research_Quests&amp;diff=7034"/>
		<updated>2017-11-15T15:26:33Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this guide we explain the quest system, how to make your own quests, and finally, for the programmers amongst you, how to create custom quest actions and conditions.&lt;br /&gt;
&lt;br /&gt;
==Quest System Overview==&lt;br /&gt;
With the release of 0.6 we have overhauled the quest system entirely, and now it is significantly more advanced than before. After observing how it worked in 0.5, all the ins-and-outs, our requirements from the system changed and so also the implementation of the system had to change.&lt;br /&gt;
&lt;br /&gt;
First, we wanted to remove the notion of quest arcs, as they were a poor solution for tying together loose quest steps, rather, we chose to create a quest that contains all of the steps by itself, rather than reverse matching the whole arc together.&lt;br /&gt;
&lt;br /&gt;
Additionally, with the introduction of the new research system, we needed some more advanced condition management for the whole quest. This helps solve the issue of people unlocking the research through a scroll, and then getting stuck in the middle of the quest.&lt;br /&gt;
&lt;br /&gt;
We also wanted to be able to have short texts on the HUD and longer texts in the book, as well as support for images inside the book. Finally, for the tutorial, we wanted to add support for making sure it only triggers once, as well as highlight the stones and other environment items, to help improve the early playing experience.&lt;br /&gt;
&lt;br /&gt;
All these requirements resulted in a complete redesign of the system. This means that all previous quests are no longer supported, which is fine because we were only using it for the tutorial previously anyway.&lt;br /&gt;
==Creating A Quest==&lt;br /&gt;
Creating a quest is an extensive project that will involve a lot of playtesting and tweaking, but the end result is a fantastic piece of gameplay that will keep people entertained for hours. The research quests will provide a lot of examples for the system, but we will explain the definitions here so you understand how it functions more accurately.&lt;br /&gt;
===Core Definition===&lt;br /&gt;
As all our other definitions, it starts with a &amp;lt;code&amp;gt;&amp;lt;Definition&amp;gt;&amp;lt;/code&amp;gt; tag, with the &amp;lt;code&amp;gt;xsi:type=”MyObjectBuilder_QuestDefinition”&amp;lt;/code&amp;gt;, and the Id that follows should be &amp;lt;code&amp;gt;Type=”QuestDefinition”&amp;lt;/code&amp;gt; and the Subtype is the identifier for your quest.&lt;br /&gt;
The result looks something like this&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_QuestDefinition&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Id Type=&amp;quot;QuestDefinition&amp;quot; Subtype=&amp;quot;EconomicSmelting&amp;quot; /&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Quest Information===&lt;br /&gt;
Quests provide a couple of bits of information that is then used by the game to present it to the player. The six values of interest are:&lt;br /&gt;
;DisplayName: This is the actual name of the quest as displayed in the game, either in the book or on the HUD tracker.&lt;br /&gt;
;Description: This is a description of what the quest is about. This can be a short text. It’s currently not displayed anywhere in the game, but we plan to use this in the future for tooltips in the quest book, etc.&lt;br /&gt;
;Icon: This is the image that appears at the top of the page in the book when the quest is selected by the player.&lt;br /&gt;
;Tag: This is a bit of metadata explaining what the quest is about. Currently, we don’t use this, but in the future we may use this for tutorials or research quests.&lt;br /&gt;
;IsAbandonable: The value is either true or false, and it indicates whether or not we want to allow the player to abandon the quest. If this is set to false the Abandon button is hidden.&lt;br /&gt;
;IsRepeatable: The value is either true or false, and it indicates whether or not a player can do this quest again after completing it once.&lt;br /&gt;
===Quest-Wide Actions and Conditions===&lt;br /&gt;
Each quest can trigger a set of actions based on a set of conditions that are not tied to a specific step. You can see great examples of these actions and conditions in use in our research quests.&lt;br /&gt;
Supported types of actions and conditions:&lt;br /&gt;
;FailCondition: If the fail condition is met, the quest is failed and the fail actions are performed.&lt;br /&gt;
;FailAction: When the quest is failed by either the fail condition, abandoned by the player, failed from the code, or failed by another quest action, the fail actions are performed.&lt;br /&gt;
;SuccessCondition: If the success condition is met, the quest is completed and the success actions are performed.&lt;br /&gt;
;SuccessAction: When the quest is completed, all the success actions are performed.&lt;br /&gt;
;StartAction: When the quest is started, all the start actions are performed.&lt;br /&gt;
===Quest Steps===&lt;br /&gt;
A quest is made out of one or more steps. Each step comes with a FullDescription and ShortDescription, though if the ShortDescription is not specified, the FullDescription is used instead. It also supports a Condition and once the Condition is met, the Actions are performed.&lt;br /&gt;
&lt;br /&gt;
Steps are always executed in the same order, from top to bottom, and when the last step is completed, the quest is considered completed.&lt;br /&gt;
===Quest Actions===&lt;br /&gt;
We currently support the following actions:&lt;br /&gt;
====Start Quest====&lt;br /&gt;
Starts another quest for the player running the current quest. If the quest was already started, or if the quest is not repeatable and has been completed in the past, this will not do anything.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.StartQuest&amp;quot; Subtype=&amp;quot;SettlingDown&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Complete Quest====&lt;br /&gt;
Flags a quest as completed for the player running the current quest. If the quest is not active this will not do anything.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.CompleteQuest&amp;quot; Subtype=&amp;quot;EconomicSmelting&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Fail Quest====&lt;br /&gt;
Flags a quest as failed for the player running the current quest. If the quest is not active this will not do anything.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.FailQuest&amp;quot; Subtype=&amp;quot;EconomicSmelting&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Unlock Research====&lt;br /&gt;
Unlocks a specific research for the player running the current quest. It supports both unlocking of research definitions as a whole, or a specific item as an override.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.UnlockResearch&amp;quot; Type=&amp;quot;ResearchDefinition&amp;quot; Subtype=&amp;quot;EconomicSmelting&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
And&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.UnlockResearch&amp;quot; Type=&amp;quot;CraftingRecipeDefinition&amp;quot; Subtype=&amp;quot;ShovelWood&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Lock Research====&lt;br /&gt;
Opposite of Unlock Research, locks a specific research for the player running the current quest. It supports both locking a whole research definition, or a specific item as an override.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.LockResearch&amp;quot; Type=&amp;quot;ResearchDefinition&amp;quot; Subtype=&amp;quot;EconomicSmelting&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
And&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.LockResearch&amp;quot; Type=&amp;quot;CraftingRecipeDefinition&amp;quot; Subtype=&amp;quot;ShovelWood&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Show Notification====&lt;br /&gt;
Displays the big “Quest Completed” notification to the player, except it also allows the quest to have a different text instead, like “Knowledge Gained”, or whatever seems appropriate for the quest at hand. It also specifies the sound effect played.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.ShowNotification&amp;quot; Text=&amp;quot;Description_Objective_Completed&amp;quot; SoundCueId=&amp;quot;QuestStepCompleted&amp;quot; SoundDelay=&amp;quot;300&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Flag Tutorial Completed====&lt;br /&gt;
Used in combination with the Tutorial Completed condition, this writes to the player’s local configuration file that the tutorial was completed.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Action xsi:type=&amp;quot;Quest.Actions.FlagTutorialCompleted&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
===Quest Conditions===&lt;br /&gt;
We currently support the following conditions:&lt;br /&gt;
====Composite====&lt;br /&gt;
Contains multiple conditions that are checked using a specified operator. Operators will be &amp;lt;code&amp;gt;AND&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OR&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
OR operator: Returns not completed until at least 1 of its child conditions are completed.&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;br /&gt;
Using composite conditions you can trigger on any condition’s completion using the OR operator. Additionally, by setting a condition with IsHidden=”true”, this condition will not show up on the HUD.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Composite&amp;quot; Operator=&amp;quot;OR&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Craft&amp;quot; Type=&amp;quot;CubeBlock&amp;quot; Subtype=&amp;quot;TableCrafting&amp;quot; Amount=&amp;quot;1&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Gather&amp;quot; Type=&amp;quot;CubeBlock&amp;quot; Subtype=&amp;quot;TableCrafting&amp;quot; Amount=&amp;quot;1&amp;quot; IsHidden=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/Condition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Example 2:&lt;br /&gt;
&lt;br /&gt;
Composite conditions can have an ActiveDescription and CompletedDescription which will then hide any of the child descriptions. It will act as if all are marked &amp;lt;code&amp;gt;IsHidden=”true”&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Composite&amp;quot; Operator=&amp;quot;OR&amp;quot; ActiveDescription=&amp;quot;Make a pickaxe at the furnace.&amp;quot; CompletedDescription=&amp;quot;Made a pickaxe.&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Craft&amp;quot; Type=&amp;quot;HandItem&amp;quot; Subtype=&amp;quot;PickaxeCopper&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Gather&amp;quot; Type=&amp;quot;HandItem&amp;quot; Subtype=&amp;quot;PickaxeCopper&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Craft&amp;quot; Type=&amp;quot;HandItem&amp;quot; Subtype=&amp;quot;PickaxeIron&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Gather&amp;quot; Type=&amp;quot;HandItem&amp;quot; Subtype=&amp;quot;PickaxeIron&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/Condition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Craft====&lt;br /&gt;
Checks if the player crafts an amount of a specific item, will also allow tags.&lt;br /&gt;
Examples:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Craft&amp;quot; Tag=&amp;quot;Timber&amp;quot; Amount=&amp;quot;3&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Craft&amp;quot; Type=&amp;quot;HandItem&amp;quot; Subtype=&amp;quot;AxeStone&amp;quot; Amount=&amp;quot;1&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
====Gather====&lt;br /&gt;
Checks if the player somehow obtains an amount of a specific item, will also allow tags.&lt;br /&gt;
Examples:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Gather&amp;quot; Tag=&amp;quot;ScrapWood&amp;quot; Amount=&amp;quot;3&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Gather&amp;quot; Type=&amp;quot;InventoryItem&amp;quot; Subtype=&amp;quot;StoneSmall&amp;quot; Amount=&amp;quot;1&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
====Build Block====&lt;br /&gt;
Checks if the player fully constructs (100%) blocks of a specific type.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.BuildBlock&amp;quot; Type=&amp;quot;CubeBlock&amp;quot; Subtype=&amp;quot;TableCrafting&amp;quot; Amount=&amp;quot;1&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Place Block====&lt;br /&gt;
Checks if the player places blocks of a specific type.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.PlaceBlock&amp;quot; Type=&amp;quot;CubeBlock&amp;quot; Subtype=&amp;quot;TableCrafting&amp;quot; Amount=&amp;quot;1&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Consume====&lt;br /&gt;
Checks if the player consumes a consumable.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Consume&amp;quot; Type=&amp;quot;ConsumableItem&amp;quot; Subtype=&amp;quot;Mushrooms&amp;quot; Amount=&amp;quot;1&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Change Character Color====&lt;br /&gt;
Checks if the player changes their suit color.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.ChangeCharacterColor&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Entity Interaction====&lt;br /&gt;
Checks if the player interacts with a specific entity, such as handcranks, gatherables, etc.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.EntityInteraction&amp;quot; Type=&amp;quot;CubeBlock&amp;quot; Subtype=&amp;quot;Wardrobe&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Tutorial Completed====&lt;br /&gt;
Checks if the player already completed the tutorial in the past. Usually used alongside the Flag Tutorial Completed quest action.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;FailCondition xsi:type=&amp;quot;Quest.Conditions.TutorialCompleted&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Quest Completed====&lt;br /&gt;
Checks if the player completes a quest successfully.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.QuestCompleted&amp;quot; Subtype=&amp;quot;MilitaryEngineering_Palisades&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Quest Failed====&lt;br /&gt;
Checks if the player fails or abandons the quest.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.QuestFailed&amp;quot; Subtype=&amp;quot;MilitaryEngineering_Palisades&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Quest Started====&lt;br /&gt;
Checks if the player starts a quest.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.QuestStarted&amp;quot; Subtype=&amp;quot;MilitaryEngineering_Palisades&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Research Unlocked====&lt;br /&gt;
Checks if the player has certain research unlocked.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.ResearchUnlocked&amp;quot; Type=&amp;quot;ResearchDefinition&amp;quot; Subtype=&amp;quot;Carpentry&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
====Prospecting====&lt;br /&gt;
Performs a prospecting quest that guides the player to within 5 meters of the specified ores.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Prospecting&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;WaypointDefinition Type=&amp;quot;WaypointDefinition&amp;quot; Subtype=&amp;quot;Ore&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;MaxSearchDistance&amp;gt;1000&amp;lt;/MaxSearchDistance&amp;gt;&lt;br /&gt;
	&amp;lt;SupportedVoxelMaterial Type=&amp;quot;VoxelMaterialDefinition&amp;quot; Subtype=&amp;quot;IronOre_PoorYield&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/Condition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
====Equip====&lt;br /&gt;
Triggers when the player equips (one of) the specified tools.&lt;br /&gt;
Usage:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Condition xsi:type=&amp;quot;Quest.Conditions.Equip&amp;quot; Type=&amp;quot;HandItem&amp;quot; Subtype=&amp;quot;AxeStone&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Item Type=&amp;quot;HandItem&amp;quot; Subtype=&amp;quot;AxeIron&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/Condition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Please be aware that a quest’s Success Condition, Fail Condition, Success Actions, Fail Actions and Start Actions are formatted the same way the regular actions are formatted, just with a different element name.&lt;br /&gt;
==Custom Quest Actions and Conditions==&lt;br /&gt;
Finally, creating your own actions and conditions is now possible as well. This will be C# heavy, but it’s not actually so complicated once you understand the process. For each type, you have to implement a couple of custom functions, and be mindful of server and client side operations.&lt;br /&gt;
===Custom Quest Actions===&lt;br /&gt;
Create the following four classes:&lt;br /&gt;
&lt;br /&gt;
MyObjectBuilder_QuestActionBaseDefinition.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System.Xml.Serialization;&lt;br /&gt;
using VRage.ObjectBuilders;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.ObjectBuilders.Definitions.Quests.Actions&lt;br /&gt;
{&lt;br /&gt;
    [MyObjectBuilderDefinition]&lt;br /&gt;
    [XmlSerializerAssembly(&amp;quot;MedievalEngineers.ObjectBuilders.XmlSerializers&amp;quot;)]&lt;br /&gt;
    [XmlType(&amp;quot;Quest.Actions.ExampleAction&amp;quot;)]&lt;br /&gt;
    public class MyObjectBuilder_QuestActionExampleActionDefinition : MyObjectBuilder_QuestActionBaseDefinition&lt;br /&gt;
    {&lt;br /&gt;
        // All properties to be loaded by the quest definition are defined here.&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
MyObjectBuilder_QuestActionExampleAction.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System.Xml.Serialization;&lt;br /&gt;
using VRage.ObjectBuilders;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.ObjectBuilders.Components.Quests.Actions&lt;br /&gt;
{&lt;br /&gt;
    [MyObjectBuilderDefinition]&lt;br /&gt;
    [XmlSerializerAssembly(&amp;quot;MedievalEngineers.ObjectBuilders.XmlSerializers&amp;quot;)]&lt;br /&gt;
    public class MyObjectBuilder_QuestActionExampleAction : MyObjectBuilder_QuestActionBase&lt;br /&gt;
    {&lt;br /&gt;
        // This class is actually not used for actions.&lt;br /&gt;
        // It has to be there for engine support.&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
MyQuestActionExampleActionDefinition.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using Medieval.ObjectBuilders.Components.Quests.Actions;&lt;br /&gt;
using Medieval.ObjectBuilders.Definitions.Quests.Actions;&lt;br /&gt;
using VRage.ObjectBuilder;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.Definitions.Quests.Actions&lt;br /&gt;
{&lt;br /&gt;
    [MyQuestActionDefinitionType(typeof(MyObjectBuilder_QuestActionExampleActionDefinition))]&lt;br /&gt;
    public class MyQuestActionExampleActionDefinition : MyQuestActionBaseDefinition&lt;br /&gt;
    {&lt;br /&gt;
        // This class contains all the properties parsed from the object builder into a game-ready format.&lt;br /&gt;
        // See the entity component modding guide for an example on how to use definitions.&lt;br /&gt;
&lt;br /&gt;
        public override void Init(MyObjectBuilder_QuestActionBaseDefinition builder)&lt;br /&gt;
        {&lt;br /&gt;
            MyObjectBuilder_QuestActionExampleActionDefinition ob = builder as MyObjectBuilder_QuestActionExampleActionDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilderType SerializedTypeId&lt;br /&gt;
        {&lt;br /&gt;
            get { return new MyObjectBuilderType(typeof(MyObjectBuilder_QuestActionExampleAction)); }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
MyQuestActionExampleAction.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using Medieval.Definitions.Quests.Actions;&lt;br /&gt;
using Medieval.ObjectBuilders.Components.Quests.Actions;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.Entities.Components.Quests.Actions&lt;br /&gt;
{&lt;br /&gt;
    [MyQuestActionType(typeof(MyObjectBuilder_QuestActionExampleAction))]&lt;br /&gt;
    public class MyQuestActionExampleAction : MyQuestActionBase&lt;br /&gt;
    {&lt;br /&gt;
        public override void Init(MyQuestActionBaseDefinition definition)&lt;br /&gt;
        {&lt;br /&gt;
            base.Init(definition);&lt;br /&gt;
&lt;br /&gt;
            MyQuestActionExampleActionDefinition def = m_definition as MyQuestActionExampleActionDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void PerformAction(MyQuestEntityComponent owner, MyQuest quest)&lt;br /&gt;
        {&lt;br /&gt;
            // Perform the logic linked to this action here.&lt;br /&gt;
            // Be mindful that you probably want to run this logic on the server, so check for IsServer here.&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
And adjust the classes as required. As this is not a full tutorial on how to make a specific effect, we will leave the topic here. The intrepid programmers amongst you are surely able to figure it out from here!&lt;br /&gt;
===Custom Quest Conditions===&lt;br /&gt;
Similar to actions, you have to create four classes:&lt;br /&gt;
&lt;br /&gt;
MyObjectBuilder_QuestConditionExampleConditionDefinition.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System.Xml.Serialization;&lt;br /&gt;
using VRage.ObjectBuilders;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.ObjectBuilders.Definitions.Quests.Conditions&lt;br /&gt;
{&lt;br /&gt;
    [MyObjectBuilderDefinition]&lt;br /&gt;
    [XmlSerializerAssembly(&amp;quot;MedievalEngineers.ObjectBuilders.XmlSerializers&amp;quot;)]&lt;br /&gt;
    [XmlType(&amp;quot;Quest.Conditions.ExampleCondition&amp;quot;)]&lt;br /&gt;
    public class MyObjectBuilder_QuestConditionExampleConditionDefinition : MyObjectBuilder_QuestConditionBaseDefinition&lt;br /&gt;
    {&lt;br /&gt;
        // All properties to be loaded by the quest definition are defined here.&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
MyObjectBuilder_QuestConditionExampleCondition.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System.Xml.Serialization;&lt;br /&gt;
using VRage.ObjectBuilders;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.ObjectBuilders.Components.Quests.Conditions&lt;br /&gt;
{&lt;br /&gt;
    [MyObjectBuilderDefinition]&lt;br /&gt;
    [XmlSerializerAssembly(&amp;quot;MedievalEngineers.ObjectBuilders.XmlSerializers&amp;quot;)]&lt;br /&gt;
    public class MyObjectBuilder_QuestConditionExampleCondition : MyObjectBuilder_QuestConditionBase&lt;br /&gt;
    {&lt;br /&gt;
        // All data to be saved by the quest condition are defined here. This way you can track progress, for example.&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
MyQuestConditionExampleConditionDefinition.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using Medieval.ObjectBuilders.Components.Quests.Conditions;&lt;br /&gt;
using Medieval.ObjectBuilders.Definitions.Quests.Conditions;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using VRage.ObjectBuilder;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.Definitions.Quests.Conditions&lt;br /&gt;
{&lt;br /&gt;
    [MyQuestConditionDefinitionType(typeof(MyObjectBuilder_QuestConditionExampleConditionDefinition))]&lt;br /&gt;
    public class MyQuestConditionExampleConditionDefinition : MyQuestConditionBaseDefinition&lt;br /&gt;
    {&lt;br /&gt;
        // This class contains all the properties parsed from the object builder into a game-ready format.&lt;br /&gt;
        // See the entity component modding guide for an example on how to use definitions.&lt;br /&gt;
&lt;br /&gt;
        public override void Init(MyObjectBuilder_QuestConditionBaseDefinition builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Init(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_QuestConditionExampleConditionDefinition ob = builder as MyObjectBuilder_QuestConditionExampleConditionDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilderType SerializedTypeId&lt;br /&gt;
        {&lt;br /&gt;
            get { return new MyObjectBuilderType(typeof(MyObjectBuilder_QuestConditionExampleCondition)); }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override List&amp;lt;string&amp;gt; GetCompletedDescription()&lt;br /&gt;
        {&lt;br /&gt;
            var list = base.GetCompletedDescription();&lt;br /&gt;
            list.Add(&amp;quot;TODO: Implement GetCompletedDescription for MyQuestConditionExampleConditionDefinition&amp;quot;);&lt;br /&gt;
            return list;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
MyQuestConditionExampleCondition.cs&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using Medieval.Definitions.Quests.Conditions;&lt;br /&gt;
using Medieval.ObjectBuilders.Components.Quests.Conditions;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
&lt;br /&gt;
namespace Medieval.Entities.Components.Quests.Conditions&lt;br /&gt;
{&lt;br /&gt;
    [MyQuestConditionType(typeof(MyObjectBuilder_QuestConditionExampleCondition))]&lt;br /&gt;
    public class MyQuestConditionExampleCondition : MyQuestConditionBase&lt;br /&gt;
    {&lt;br /&gt;
        #region (De)serialization&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_QuestConditionBase builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_QuestConditionExampleCondition ob = builder as MyObjectBuilder_QuestConditionExampleCondition;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_QuestConditionBase Serialize()&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize();&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_QuestConditionExampleCondition ob = builder as MyObjectBuilder_QuestConditionExampleCondition;&lt;br /&gt;
&lt;br /&gt;
            return builder;&lt;br /&gt;
        }&lt;br /&gt;
        #endregion (De)serialization&lt;br /&gt;
&lt;br /&gt;
        #region (De)activation&lt;br /&gt;
        // Called when the quest or step is activated.&lt;br /&gt;
        // Hook to game events here.&lt;br /&gt;
        public override void Activate(MyQuestEntityComponent owner, MyQuest quest)&lt;br /&gt;
        {&lt;br /&gt;
            base.Activate(owner, quest);&lt;br /&gt;
&lt;br /&gt;
            MyQuestConditionExampleConditionDefinition definition = m_definition as MyQuestConditionExampleConditionDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Called when the quest or step deactivates. For example, when the quest is completed, abandoned, the quest step completes or the player leaves the server.&lt;br /&gt;
        // Unhook game events here.&lt;br /&gt;
        public override void Deactivate()&lt;br /&gt;
        {&lt;br /&gt;
            base.Deactivate();&lt;br /&gt;
        }&lt;br /&gt;
        #endregion (De)activation&lt;br /&gt;
&lt;br /&gt;
        #region Description&lt;br /&gt;
        // Return the active description here. This will be shown on the HUD.&lt;br /&gt;
        public override List&amp;lt;string&amp;gt; GetDescription()&lt;br /&gt;
        {&lt;br /&gt;
            var list = base.GetDescription();&lt;br /&gt;
&lt;br /&gt;
            if (IsCompleted)&lt;br /&gt;
            {&lt;br /&gt;
                list.AddRange(m_definition.GetCompletedDescription());&lt;br /&gt;
            }&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                MyQuestConditionExampleConditionDefinition definition = m_definition as MyQuestConditionExampleConditionDefinition;&lt;br /&gt;
                list.Add(&amp;quot;TODO: Implement in progress description for MyQuestConditionExampleConditionDefinition&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            return list;&lt;br /&gt;
        }&lt;br /&gt;
        #endregion Description&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
And adjust the classes as required. As this is not a full tutorial on how to make a specific effect, we will leave the topic here. The intrepid programmers amongst you are surely able to figure it out from here!&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3444</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3444"/>
		<updated>2017-06-11T19:01:20Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
In many places the game relies on the Init method only being called once. You should never call the Init method from within your code, doing so may cause unpredictable behaviour and instability!&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        private MyNameOfComponentDefinition m_definition = null;&lt;br /&gt;
&lt;br /&gt;
        public override void Init(MyEntityComponentDefinition definition)&lt;br /&gt;
        {&lt;br /&gt;
            m_definition = definition as MyNameOfComponentDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called when the game is being saved or loaded respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;font style=&amp;quot;font-size:80%; color: #bd3232;&amp;quot;&amp;gt;Warning: Mods with custom object builders&amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
{{TextBoxRed|Once a world is saved with a mod with a custom object builder it is currently no longer possible to remove this mod from the world. The game will no longer be able to deserialize the data correctly! This is something we will look into resolving in the future.}}&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override void OnAddedToScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnAddedToScene();&lt;br /&gt;
&lt;br /&gt;
            // Register for update once every 1000 milliseconds (1 second)&lt;br /&gt;
            MyUpdateComponent.Static.AddForUpdate(Update, 1000);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void OnRemovedFromScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnRemovedFromScene();&lt;br /&gt;
&lt;br /&gt;
            // Unregister for updates&lt;br /&gt;
            MyUpdateComponent.Static.RemoveFromUpdate(Update);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3443</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3443"/>
		<updated>2017-06-11T18:52:31Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
In many places the game relies on the Init method only being called once. You should never call the Init method from within your code, doing so may cause unpredictable behaviour and instability!&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        private MyNameOfComponentDefinition m_definition = null;&lt;br /&gt;
&lt;br /&gt;
        public override void Init(MyEntityComponentDefinition definition)&lt;br /&gt;
        {&lt;br /&gt;
            m_definition = definition as MyNameOfComponentDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;font style=&amp;quot;font-size:80%; color: #bd3232;&amp;quot;&amp;gt;Warning: Mods with custom object builders&amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
{{TextBoxRed|Once a world is saved with a mod with a custom object builder it is currently no longer possible to remove this mod from the world. The game will no longer be able to deserialize the data correctly! This is something we will look into resolving in the future.}}&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override void OnAddedToScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnAddedToScene();&lt;br /&gt;
&lt;br /&gt;
            // Register for update once every 1000 milliseconds (1 second)&lt;br /&gt;
            MyUpdateComponent.Static.AddForUpdate(Update, 1000);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void OnRemovedFromScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnRemovedFromScene();&lt;br /&gt;
&lt;br /&gt;
            // Unregister for updates&lt;br /&gt;
            MyUpdateComponent.Static.RemoveFromUpdate(Update);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3442</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3442"/>
		<updated>2017-06-11T18:28:29Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        private MyNameOfComponentDefinition m_definition = null;&lt;br /&gt;
&lt;br /&gt;
        public override void Init(MyEntityComponentDefinition definition)&lt;br /&gt;
        {&lt;br /&gt;
            m_definition = definition as MyNameOfComponentDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;font style=&amp;quot;font-size:80%; color: #bd3232;&amp;quot;&amp;gt;Warning: Mods with custom object builders&amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
{{TextBoxRed|Once a world is saved with a mod with a custom object builder it is currently no longer possible to remove this mod from the world. The game will no longer be able to deserialize the data correctly! This is something we will look into resolving in the future.}}&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override void OnAddedToScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnAddedToScene();&lt;br /&gt;
&lt;br /&gt;
            // Register for update once every 1000 milliseconds (1 second)&lt;br /&gt;
            MyUpdateComponent.Static.AddForUpdate(Update, 1000);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void OnRemovedFromScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnRemovedFromScene();&lt;br /&gt;
&lt;br /&gt;
            // Unregister for updates&lt;br /&gt;
            MyUpdateComponent.Static.RemoveFromUpdate(Update);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3441</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3441"/>
		<updated>2017-06-11T18:26:50Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        private MyNameOfComponentDefinition m_definition = null;&lt;br /&gt;
&lt;br /&gt;
        public override void Init(MyEntityComponentDefinition definition)&lt;br /&gt;
        {&lt;br /&gt;
            m_definition = definition as MyNameOfComponentDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;font style=&amp;quot;font-size:80%; color: #bd3232;&amp;quot;&amp;gt;Warning: Mods with custom object builders&amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
{{TextBoxRed|Once a world is saved with a mod with a custom object builder it is currently no longer possible to remove this mod from the world. The game will no longer be able to deserialize the data correctly! This is something we will look into resolving in the future.}}&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override void OnAddedToScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnAddedToScene();&lt;br /&gt;
&lt;br /&gt;
            // Register for update once every 1000 milliseconds (1 second)&lt;br /&gt;
            MyUpdateComponent.Static.AddForUpdate(Update, 1000);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void OnRemovedFromScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnRemovedFromScene();&lt;br /&gt;
&lt;br /&gt;
            // Unregister for updates&lt;br /&gt;
            MyUpdateComponent.Static.RemoveFromUpdate(Update);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3440</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3440"/>
		<updated>2017-06-11T18:26:20Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        private MyNameOfComponentDefinition m_definition = null;&lt;br /&gt;
&lt;br /&gt;
        public override void Init(MyEntityComponentDefinition definition)&lt;br /&gt;
        {&lt;br /&gt;
            m_definition = definition as MyNameOfComponentDefinition;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override void OnAddedToScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnAddedToScene();&lt;br /&gt;
&lt;br /&gt;
            // Register for update once every 1000 milliseconds (1 second)&lt;br /&gt;
            MyUpdateComponent.Static.AddForUpdate(Update, 1000);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void OnRemovedFromScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnRemovedFromScene();&lt;br /&gt;
&lt;br /&gt;
            // Unregister for updates&lt;br /&gt;
            MyUpdateComponent.Static.RemoveFromUpdate(Update);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;font style=&amp;quot;font-size:80%; color: #bd3232;&amp;quot;&amp;gt;Warning: Mods with custom object builders&amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
{{TextBoxRed|Once a world is saved with a mod with a custom object builder it is currently no longer possible to remove this mod from the world. The game will no longer be able to deserialize the data correctly! This is something we will look into resolving in the future.}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3439</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3439"/>
		<updated>2017-06-11T18:25:25Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override void OnAddedToScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnAddedToScene();&lt;br /&gt;
&lt;br /&gt;
            // Register for update once every 1000 milliseconds (1 second)&lt;br /&gt;
            MyUpdateComponent.Static.AddForUpdate(Update, 1000);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void OnRemovedFromScene()&lt;br /&gt;
        {&lt;br /&gt;
            base.OnRemovedFromScene();&lt;br /&gt;
&lt;br /&gt;
            // Unregister for updates&lt;br /&gt;
            MyUpdateComponent.Static.RemoveFromUpdate(Update);&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;font style=&amp;quot;font-size:80%; color: #bd3232;&amp;quot;&amp;gt;Warning: Mods with custom object builders&amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
{{TextBoxRed|Once a world is saved with a mod with a custom object builder it is currently no longer possible to remove this mod from the world. The game will no longer be able to deserialize the data correctly! This is something we will look into resolving in the future.}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3438</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3438"/>
		<updated>2017-06-11T18:23:46Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: /* Serialize / Deserialize */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;font style=&amp;quot;font-size:80%; color: #bd3232;&amp;quot;&amp;gt;Warning: Mods with custom object builders&amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
{{TextBoxRed|Once a world is saved with a mod with a custom object builder it is currently no longer possible to remove this mod from the world. The game will no longer be able to deserialize the data correctly! This is something we will look into resolving in the future.}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3437</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3437"/>
		<updated>2017-06-11T18:22:14Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: /* Serialize / Deserialize */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C#&amp;quot; collapse=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
        public override bool IsSerialized&lt;br /&gt;
        {&lt;br /&gt;
            get { return true; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override void Deserialize(MyObjectBuilder_EntityComponent builder)&lt;br /&gt;
        {&lt;br /&gt;
            base.Deserialize(builder);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            m_myImportantVariable = myObjectBuilder.ImportantVariable;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public override MyObjectBuilder_EntityComponent Serialize(bool copy = false)&lt;br /&gt;
        {&lt;br /&gt;
            var builder = base.Serialize(copy);&lt;br /&gt;
&lt;br /&gt;
            MyObjectBuilder_NameOfComponent myObjectBuilder = builder as MyObjectBuilder_NameOfComponent ;&lt;br /&gt;
            myObjectBuilder.ImportantVariable = m_myImportantVariable;&lt;br /&gt;
&lt;br /&gt;
            return ob;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3436</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3436"/>
		<updated>2017-06-11T18:18:11Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene / OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Serialize / Deserialize===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3435</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3435"/>
		<updated>2017-06-11T18:17:32Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: /* Init */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component from the Init method.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene/OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Serialization/Deserialization===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3434</id>
		<title>Keen:Entity Component Overview</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Entity_Component_Overview&amp;diff=3434"/>
		<updated>2017-06-11T18:16:34Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: A quick overview of the most important methods of an entity component.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Entity Component Important Functions==&lt;br /&gt;
Entity components consist of a couple of important methods, and it is important to know what they do and what their intended purpose is.&lt;br /&gt;
&lt;br /&gt;
===Attributes===&lt;br /&gt;
Entity Components can be decorated with some attributes which in turn inform the game about important things regarding this entity component. Here follows a non-exhaustive list of Entity Component attributes:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;MyComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: MyComponent attribute marks this class as an Entity Component. The type passed into MyComponent is the save data object builder used for saving data to the world.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [MyComponent(typeof(MyObjectBuilder_NameOfComponent)]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;ReplicatedComponent&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Description: ReplicatedComponent attribute marks this Entity Component as relevant for Replication. Required for sending messages across the network.&amp;lt;br /&amp;gt;&lt;br /&gt;
Usage: [ReplicatedComponent]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Constructor===&lt;br /&gt;
The class constructor is a core C# feature that is called on each instantiation of the class. This goes for Entity Components as well.&amp;lt;br /&amp;gt;&lt;br /&gt;
The intended purpose of the constructor should be to initialize variables to their default values. It should never interface with any elements outside the entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Init===&lt;br /&gt;
The Init method is called when the entity component is initialized externally. This means that certain elements of the game are available.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, the argument for the Init method is the definition of the entity component. This is the parsed data from the SBC file, converted into a Definition class.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
When an entity component is being initialized it is not yet assigned to its parent Entity, and thus the Entity parameter may still be null.&amp;lt;br /&amp;gt;&lt;br /&gt;
Additionally, when entity components are being initialized, the game may still be loading, and some elements of the game are not yet ready.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
You should never interact with any entity components external to this entity component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===OnAddedToScene/OnRemovedFromScene===&lt;br /&gt;
The OnAddedToScene method is called whenever an entity component&#039;s parent entity is finished initializing and is added to the scene. At this point it is safe to interact with the parent Entity as well as other entity components and elements in the game. This is the moment where it is possible to register to events, get references to other components, etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OnRemovedFromScene is called right after an entity was taken out of the world. If you registered to any events in OnAddedToScene you should remove them here.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Serialization/Deserialization===&lt;br /&gt;
The Serialize and Deserialize methods are called for Saving and Loading the saved world data respectively. Serialize returns an object builder which you can receive through base.Serialize(copy). Deserialize receives the object builder from the world and you can read your data from there.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ObjectBuilder that is used by these methods are specified by the [MyComponent] attribute at the top.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Please be aware that Serialize and Deserialize are not called unless you override IsSerialized and return true.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Visual_Studio_Setup_Guide&amp;diff=3423</id>
		<title>Keen:Visual Studio Setup Guide</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Visual_Studio_Setup_Guide&amp;diff=3423"/>
		<updated>2017-05-30T16:32:33Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will walk you through how to install and set up Visual Studio 2017 to start programming in Medieval Engineers whether it&#039;s an in-game script or a mod. In order to use the ME assemblies, we recommend Visual Studio 2017. There is a confirmed compiler crash in 2013 and we haven&#039;t tested 2015.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
You can get Visual Studio 2017 from http://www.visualstudio.com. The Community edition is free and is all you need to program in Medieval Engineers.&lt;br /&gt;
&lt;br /&gt;
When installing you should only need the .NET desktop development package.&lt;br /&gt;
&lt;br /&gt;
==Starting a Project==&lt;br /&gt;
Starting a Medieval Engineers scripting project in Visual Studio is pretty simple.&lt;br /&gt;
# Open Visual Studio and at the top left of the window click File &amp;gt; New &amp;gt; Project or press Ctrl + Shift + N.&lt;br /&gt;
# In the dialog that appears, find the C# templates and select the &amp;quot;Class Library (.NET Standard)&amp;quot; template. Name the project if you want to and click OK.&lt;br /&gt;
# In the solution explorer of VS, right-click the Project (ClassLibrary1 by default) &amp;gt; Add &amp;gt; Reference... and click Browse in the dialog that appears.&lt;br /&gt;
# Navigate to the Medieval Engineers - Mod SDK installation directory, which is usually [Steam installation directory]\steamapps\common\MedievalEngineersModSDK\OriginalContent\ModTools. If you don&#039;t have the Medieval Engineers - Mod SDK you can download it from Steam by going to Library &amp;gt; Tools.&lt;br /&gt;
# Click MedievalEngineersModAPI.dll and click Add. Make Sure its box is checked and click OK.&lt;br /&gt;
# In the solution explorer of VS, delete all references other than MedievalEngineersModAPI. We include a special subset of the default libraries, giving you all the whitelisted interfaces from there as well.&lt;br /&gt;
# If you are creating a mod, this is all the setup you need to do to start using the Mod API.&lt;br /&gt;
&lt;br /&gt;
If you have any existing projects you will want to remove all other assemblies and usings. We&#039;ve whitelisted many partial system classes in the game so it is best to use what is available in the MedievalEngineersModAPI.dll&lt;br /&gt;
&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Troubleshooting/Game_Won%27t_Start&amp;diff=435</id>
		<title>Keen:Troubleshooting/Game Won&#039;t Start</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Troubleshooting/Game_Won%27t_Start&amp;diff=435"/>
		<updated>2017-02-09T09:00:36Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: /* BLACK SCREEN ON GAME LAUNCH */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BLACK SCREEN ON GAME LAUNCH==&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: When the game launches, all you see is a black screen and the game does not appear to launch.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: The primary cause for this issue is a bug in the Intel Graphics Drivers. In case you are playing on a laptop with Windows 10 installed, that has a dedicated NVidia GPU as well as integrated graphics, you may experience this problem. The fastest way for you to resolve this issue is to update your Intel Graphics Drivers from http://www.intel.com/content/www/us/en/support/graphics-drivers.html and that usually resolves the problem.&lt;br /&gt;
&lt;br /&gt;
==VERIFY INTEGRITY OF GAME CACHE==&lt;br /&gt;
This checks that you have all the game files correctly installed in your computer and fixes them if not.&lt;br /&gt;
&lt;br /&gt;
To verify the integrity of your game’s cache&lt;br /&gt;
* Go to your game library on steam&lt;br /&gt;
* Right click on Medieval Engineers&lt;br /&gt;
* Select properties&lt;br /&gt;
* Select local files tab&lt;br /&gt;
* Click on Verify Integrity of Game Cache&lt;br /&gt;
* Wait until the cache is verified&lt;br /&gt;
==UNSUPPORTED GPU / DirectX 11==&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: When you are unable to launch the game and the error message that you get suggests it is a video / graphics / DirectX problem. This is the most reported issue so far and we are working on possible fixes. Please first make sure that your graphic card is within the minimum system requirements.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: If you meet the minimum specs in ALL area’s then please ensure that Graphics card drivers are up to date from http://www.nvidia.com or http://www.ati.com as well as Windows updates are fully installed for your operating system.&lt;br /&gt;
: Reinstall/update your DirectX to the latest version: https://support.microsoft.com/en-us/kb/179113&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: When your GPU supports DirectX 11, but the game crashes/refuses to launch. This is usually caused by having two graphics cards in one PC.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: Read [http://forums.keenswh.com/post?id=7310031 more information] about this problem.&lt;br /&gt;
: Force the game to use [http://forums.keenswh.com/post?id=7303908 one graphics card over another].&lt;br /&gt;
==REINSTALL MICROSOFT .NET FRAMEWORK==&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: Sometimes Medieval Engineers crashes before the game starts. The most common reason is wrong/damaged Microsoft .NET installation. In this case the log file contains “System.Web.Extensions”.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: Uninstall all .NET frameworks from your computer by entering Control Panel – Uninstall a program and removing all versions of .NET Framework&lt;br /&gt;
: Then install the [https://www.microsoft.com/en-us/download/details.aspx?id=49981 newest .NET] again.&lt;br /&gt;
: If it didn’t help, you may try a more [http://cybernetnews.com/remove-or-reinstall-net-framework/ advanced method].&lt;br /&gt;
: This method will fix broken .NET configuration.&lt;br /&gt;
&lt;br /&gt;
Useful Tools:&lt;br /&gt;
Detects and tries to fix some frequently occurring issues with the setup of [http://www.microsoft.com/en-us/download/details.aspx?id=30135 Microsoft .NET Framework].&amp;lt;br /&amp;gt;&lt;br /&gt;
.NET Framework Cleanup Tool [http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx User’s Guide].&lt;br /&gt;
==MULTIPLE GPUs – DISABLE SLI / CROSSFIRE==&lt;br /&gt;
At this point, Medieval Engineers doesn’t support multiple GPUs. So if you start the game with them, you may encounter crashes, graphical artifacts or even problems running the game. You need to disable this function in order to make the game work properly.&lt;br /&gt;
&lt;br /&gt;
HOW TO DISABLE:&lt;br /&gt;
;For Crossfire&lt;br /&gt;
: right-click on your desktop and select Catalyst Control Center. Click Graphics -&amp;gt; CrossfireX -&amp;gt; uncheck Enable Crossfire. Then click ok.&lt;br /&gt;
&lt;br /&gt;
;For SLI&lt;br /&gt;
: right-click on your desktop and select Nvidia Control Panel. Expand 3D Settings tab -&amp;gt; click on Set SLI Configuration -&amp;gt; select Do Not Use SLI Technology. Apply changes.&lt;br /&gt;
==OTHER ISSUES==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: TeamSpeak 3 overlay issue – The game does not start and an error appears which says “the game is already launched”.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: This issue is mostly caused by the TeamSpeak 3 overlay. In order to fix this, turn the overlay plugin off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: The game crashes after you click “Play” and you get a message saying “Space Engineers has stopped working” – LogMeIn issue&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: We have noticed that LogMeIn sometimes can cause the GPU driver to crash which prevents the game from starting. In order to fix this you will have to disable LogMeIn.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: Disk read error when starting game.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: Just restart your computer and it will be solved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: Your logfile says: ‘HavokWrapper.dll’ access denied&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: This is usually a file permission issue: start Steam as Administrator or change file permissions manually.&lt;br /&gt;
Or antivirus issue: add an exception for MedievalEngineers.exe and/or HavokWrapper.dll&lt;br /&gt;
If you are concerned about security check HavokWrapper.dll digital signature in file properties (make sure you click “Details” on digital signature tab).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
More solutions can be found on the [http://www.spaceengineersgame.com/game-wont-start-issues.html Space Engineers website].&lt;br /&gt;
==ANTI-VIRUS SOFTWARE==&lt;br /&gt;
It has been reported by players that some anti-virus software (most common is AVAST) are blocking the game and prevent it from starting. This happens because the game’s code is encrypted which is why the anti-virus software are flagging it as a virus. This is false positive and the solution is to add the file to exceptions or mark it as a save file.&lt;br /&gt;
==3rd PARTY PROGRAMS &amp;amp; APPS==&lt;br /&gt;
It has been reported that some 3rd party programs can prevent the game from starting. In this case, you will have to disable these programs in order to run the game. Below is the list of the 3rd party programs that have been reported so far.&lt;br /&gt;
* AMD Raptr&lt;br /&gt;
* Lucid Virtu MVP&lt;br /&gt;
* MacType&lt;br /&gt;
* LogMeIn&lt;br /&gt;
* xFire&lt;br /&gt;
* Carbonite Backup&lt;br /&gt;
[[Category:Keen_Help]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Troubleshooting/Game_Won%27t_Start&amp;diff=434</id>
		<title>Keen:Troubleshooting/Game Won&#039;t Start</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Troubleshooting/Game_Won%27t_Start&amp;diff=434"/>
		<updated>2017-02-09T09:00:18Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: Black Screen issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==BLACK SCREEN ON GAME LAUNCH==&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: When the game launches, all you see is a black screen and the game does not appear to launch.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
; The primary cause for this issue is a bug in the Intel Graphics Drivers. In case you are playing on a laptop with Windows 10 installed, that has a dedicated NVidia GPU as well as integrated graphics, you may experience this problem. The fastest way for you to resolve this issue is to update your Intel Graphics Drivers from http://www.intel.com/content/www/us/en/support/graphics-drivers.html and that usually resolves the problem.&lt;br /&gt;
&lt;br /&gt;
==VERIFY INTEGRITY OF GAME CACHE==&lt;br /&gt;
This checks that you have all the game files correctly installed in your computer and fixes them if not.&lt;br /&gt;
&lt;br /&gt;
To verify the integrity of your game’s cache&lt;br /&gt;
* Go to your game library on steam&lt;br /&gt;
* Right click on Medieval Engineers&lt;br /&gt;
* Select properties&lt;br /&gt;
* Select local files tab&lt;br /&gt;
* Click on Verify Integrity of Game Cache&lt;br /&gt;
* Wait until the cache is verified&lt;br /&gt;
==UNSUPPORTED GPU / DirectX 11==&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: When you are unable to launch the game and the error message that you get suggests it is a video / graphics / DirectX problem. This is the most reported issue so far and we are working on possible fixes. Please first make sure that your graphic card is within the minimum system requirements.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: If you meet the minimum specs in ALL area’s then please ensure that Graphics card drivers are up to date from http://www.nvidia.com or http://www.ati.com as well as Windows updates are fully installed for your operating system.&lt;br /&gt;
: Reinstall/update your DirectX to the latest version: https://support.microsoft.com/en-us/kb/179113&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: When your GPU supports DirectX 11, but the game crashes/refuses to launch. This is usually caused by having two graphics cards in one PC.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: Read [http://forums.keenswh.com/post?id=7310031 more information] about this problem.&lt;br /&gt;
: Force the game to use [http://forums.keenswh.com/post?id=7303908 one graphics card over another].&lt;br /&gt;
==REINSTALL MICROSOFT .NET FRAMEWORK==&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: Sometimes Medieval Engineers crashes before the game starts. The most common reason is wrong/damaged Microsoft .NET installation. In this case the log file contains “System.Web.Extensions”.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: Uninstall all .NET frameworks from your computer by entering Control Panel – Uninstall a program and removing all versions of .NET Framework&lt;br /&gt;
: Then install the [https://www.microsoft.com/en-us/download/details.aspx?id=49981 newest .NET] again.&lt;br /&gt;
: If it didn’t help, you may try a more [http://cybernetnews.com/remove-or-reinstall-net-framework/ advanced method].&lt;br /&gt;
: This method will fix broken .NET configuration.&lt;br /&gt;
&lt;br /&gt;
Useful Tools:&lt;br /&gt;
Detects and tries to fix some frequently occurring issues with the setup of [http://www.microsoft.com/en-us/download/details.aspx?id=30135 Microsoft .NET Framework].&amp;lt;br /&amp;gt;&lt;br /&gt;
.NET Framework Cleanup Tool [http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx User’s Guide].&lt;br /&gt;
==MULTIPLE GPUs – DISABLE SLI / CROSSFIRE==&lt;br /&gt;
At this point, Medieval Engineers doesn’t support multiple GPUs. So if you start the game with them, you may encounter crashes, graphical artifacts or even problems running the game. You need to disable this function in order to make the game work properly.&lt;br /&gt;
&lt;br /&gt;
HOW TO DISABLE:&lt;br /&gt;
;For Crossfire&lt;br /&gt;
: right-click on your desktop and select Catalyst Control Center. Click Graphics -&amp;gt; CrossfireX -&amp;gt; uncheck Enable Crossfire. Then click ok.&lt;br /&gt;
&lt;br /&gt;
;For SLI&lt;br /&gt;
: right-click on your desktop and select Nvidia Control Panel. Expand 3D Settings tab -&amp;gt; click on Set SLI Configuration -&amp;gt; select Do Not Use SLI Technology. Apply changes.&lt;br /&gt;
==OTHER ISSUES==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: TeamSpeak 3 overlay issue – The game does not start and an error appears which says “the game is already launched”.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: This issue is mostly caused by the TeamSpeak 3 overlay. In order to fix this, turn the overlay plugin off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: The game crashes after you click “Play” and you get a message saying “Space Engineers has stopped working” – LogMeIn issue&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: We have noticed that LogMeIn sometimes can cause the GPU driver to crash which prevents the game from starting. In order to fix this you will have to disable LogMeIn.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: Disk read error when starting game.&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: Just restart your computer and it will be solved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PROBLEM&lt;br /&gt;
: Your logfile says: ‘HavokWrapper.dll’ access denied&lt;br /&gt;
;SOLUTION&lt;br /&gt;
: This is usually a file permission issue: start Steam as Administrator or change file permissions manually.&lt;br /&gt;
Or antivirus issue: add an exception for MedievalEngineers.exe and/or HavokWrapper.dll&lt;br /&gt;
If you are concerned about security check HavokWrapper.dll digital signature in file properties (make sure you click “Details” on digital signature tab).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
More solutions can be found on the [http://www.spaceengineersgame.com/game-wont-start-issues.html Space Engineers website].&lt;br /&gt;
==ANTI-VIRUS SOFTWARE==&lt;br /&gt;
It has been reported by players that some anti-virus software (most common is AVAST) are blocking the game and prevent it from starting. This happens because the game’s code is encrypted which is why the anti-virus software are flagging it as a virus. This is false positive and the solution is to add the file to exceptions or mark it as a save file.&lt;br /&gt;
==3rd PARTY PROGRAMS &amp;amp; APPS==&lt;br /&gt;
It has been reported that some 3rd party programs can prevent the game from starting. In this case, you will have to disable these programs in order to run the game. Below is the list of the 3rd party programs that have been reported so far.&lt;br /&gt;
* AMD Raptr&lt;br /&gt;
* Lucid Virtu MVP&lt;br /&gt;
* MacType&lt;br /&gt;
* LogMeIn&lt;br /&gt;
* xFire&lt;br /&gt;
* Carbonite Backup&lt;br /&gt;
[[Category:Keen_Help]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Subpart_Animation_System&amp;diff=341</id>
		<title>Keen:Subpart Animation System</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Subpart_Animation_System&amp;diff=341"/>
		<updated>2017-02-01T21:25:38Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: Improved URL link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Outline==&lt;br /&gt;
As of version 0.4.0 we introduced the new subpart animation system. The new subpart animation system allows modders to create animations on any cube block. It is no longer required to make any animated block a MyMedievalDoor block. The new system is a lot more powerful than the old system and will allow a lot more creative freedom and expansion.&lt;br /&gt;
&lt;br /&gt;
It is recommended to no longer use MyMedievalDoor for block animations. It is now deprecated and will be going away eventually.&lt;br /&gt;
&lt;br /&gt;
In this document the new system is explained. First, there will be an overview of the new components we have added. After that, the document will explain more in-depth how to create a new block. Finally, the interaction of players with the block will be explained, both through scripting and through ModAPI.&lt;br /&gt;
&lt;br /&gt;
For any questions regarding this guide it is recommended to ask the community on the forum or Discord. Asking a Medieval Engineers programmer is also an option, if this option is available to the reader.&lt;br /&gt;
&lt;br /&gt;
==Block components overview==&lt;br /&gt;
In this chapter the components involved in the subpart animations are defined. For each component a short description will be given, explaining its purpose and reason for existence. The designer is able to custom-tailer the behaviour of their block through specifying which components they want. Some components require other components to be there, but the designer is otherwise free to do what they believe they need.&lt;br /&gt;
===MyCubeBlockSubpartsComponent===&lt;br /&gt;
This is the root component for the entire system. The subpart component defines what subparts exist on the block’s model. It also loads and stores subpart states between game saves, as well as synchronizes the subpart states over the network. This component allows designers to specify the subparts for the cubeblocks.&lt;br /&gt;
&lt;br /&gt;
All the other subpart affecting components require this component to be present on the cubeblock, they will throw an error if added without this component present.&lt;br /&gt;
===MySubpartAnimationComponent===&lt;br /&gt;
This component defines the animations for the subparts. It is able to create animation sequences, perform subpart rotation and translation, and trigger animation events. The animations can use various interpolation curves, see “Appendix A: Interpolation equations” for more information. This component is also responsible for loading and storing the currently active animation for game saves, as well as synchronizing the active animation over the network.&lt;br /&gt;
&lt;br /&gt;
This component allows designers to specify the animations for the cubeblocks.&lt;br /&gt;
&lt;br /&gt;
It requires the MyCubeBlockSubpartsComponent to be present on the cubeblock to function.&lt;br /&gt;
===MyEntityStateComponent===&lt;br /&gt;
This component defines entity states. While the component itself is very simple, its functionality is actually really powerful. It is a basic state machine. It is possible to set up states and the possible transitions to other states. It triggers an event whenever the state is changed, and it is possible for other components to listen to this. This component allows designers to set up entity states for their blocks, which other components and scripts can respond to.&lt;br /&gt;
===MyAnimationEventSoundComponent===&lt;br /&gt;
This component can respond to animation events and will be able to play audio upon certain events being triggered. This component allows designers to add sound effects to their animations.&lt;br /&gt;
&lt;br /&gt;
It requires the MySubpartAnimationComponent to be present on the cubeblock to function.&lt;br /&gt;
===MyAnimationEventStateTransitionComponent===&lt;br /&gt;
This component is used to trigger entity state transitions when animation events occur. This will allow designers to create more complicated entities and have them reflect their state correctly.&lt;br /&gt;
&lt;br /&gt;
It requires both the MySubpartAnimationComponent and MyEntityStateComponent to be present on the entity to function.&lt;br /&gt;
&lt;br /&gt;
===MyStateAnimationComponent===&lt;br /&gt;
The state animation component listens to state transition events by the MyEntityStateComponent and tells the MySubpartAnimationComponent to start playing animations. It allows the designer to create a block that automatically responds to entity state changes.&lt;br /&gt;
&lt;br /&gt;
This component requires both the MyEntityStateComponent and MySubpartAnimationComponent to be present on the block to function.&lt;br /&gt;
===MyUseObjectsComponent===&lt;br /&gt;
This component simply specifies the use objects available on the entity. Use objects are the elements players can aim at and interact with by pressing their Use key. For this system, all use objects should use the Generic use object.&lt;br /&gt;
&lt;br /&gt;
The MyUseObjectGeneric use object has a public event modders can register to, to receive events whenever the user interacts with the object.&lt;br /&gt;
===MyStateUseObjectComponent===&lt;br /&gt;
The state use object component specifies the actions that can be performed on the object. It will show the player a notification displaying what they can do with this object. It is possible to specify which state transitions are performed when the object is interacted with. This component allows designers to create dynamic use object reactions to their cubeblocks.&lt;br /&gt;
&lt;br /&gt;
Whenever the object is interacted with it will select all possible actions that match the detector name, the current active state, and then it will select the first allowed action. Any other actions that matched the requirements will be ignored.&lt;br /&gt;
&lt;br /&gt;
This component acts as a data interface for the Generic use object. If it is not present, the Generic Use Object will not do anything.&lt;br /&gt;
===MyStateTimerComponent===&lt;br /&gt;
The state timer component is a simple component that listens to state change triggers and will schedule a new transition after a set amount of time. This component allows designers to create objects that perform automatic behaviour, such as a door that closes itself after a few seconds.&lt;br /&gt;
&lt;br /&gt;
This component requires the MyEntityStateComponent to be present to function.&lt;br /&gt;
&lt;br /&gt;
==Creating a new block==&lt;br /&gt;
This chapter will explain the steps required to create a new block. For this purpose, one of the blocks in the game will be used as an example, to showcase all the features that are currently available in the game. If new elements are added in the future, this manual will be updated where applicable.&lt;br /&gt;
&lt;br /&gt;
For the purpose of this document, the block that will be explained is the palisade gate. It is a newly introduced gate block that fits well with the palisade walls. The exact details can be found in ./Content/Data/CubeBlocks/Doors/PalisadeGate.sbc in case more information is required.&lt;br /&gt;
===Setting up cube block definition===&lt;br /&gt;
The first required element for creating a new block is the CubeBlock definition. The CubeBlock definition is the same as it has always been, so setting this one up is pretty simple. The most important thing to take note of here is the SubtypeId value.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;CubeBlocks&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_CubeBlockDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlock&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/CubeBlocks&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Setting up the subparts===&lt;br /&gt;
After setting up the cube block definition, the first new component must be added. This is the CubeBlock Subpart Component, and its definition looks like thus:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_CubeBlockSubpartComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Id&amp;gt;&lt;br /&gt;
    &amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlockSubpartComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
    &amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
  &amp;lt;/Id&amp;gt;&lt;br /&gt;
  &amp;lt;Subparts&amp;gt;&lt;br /&gt;
  &amp;lt;/Subparts&amp;gt;&lt;br /&gt;
&amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The SubtypeId value needs to be identical to the CubeBlock definition, and it is case sensitive.&lt;br /&gt;
&lt;br /&gt;
====Setting up subparts====&lt;br /&gt;
The Palisade Gate has two subparts, the left and right gate. And these need to be defined in the subpart component. This definition goes right after &amp;lt;Subparts&amp;gt; and looks like thus:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  	&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; HingeBone=&amp;quot;PalisadeGateLargeLeft_Pin&amp;quot; RequiresAxialCorrection=&amp;quot;false&amp;quot; HasDummy=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; HingeBone=&amp;quot;PalisadeGateLargeRight_Pin&amp;quot; RequiresAxialCorrection=&amp;quot;false&amp;quot; HasDummy=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
RequiresAxialCorrection is a flag necessary if the doors are not where they were expected to be. Usually, this means that either oriented the block is oriented incorrectly in the 3D editor, or it was exported incorrectly. Axial Correction will invert the Z axis, and swap the X and Y axes. This was necessary for some of the older blocks, as changing them in the editor now would mean all the blocks would rotate in the existing blueprints on the steam workshop.&lt;br /&gt;
&lt;br /&gt;
HasDummy is a new feature, introduced in 0.4.4, where it allows the interaction dummy to move with the moving parts. This provides a more intuitive interaction model, however it has some implementation issues currently, where it does not obey access rights correctly. It is not recommended for blocks that utilize the permissions system.&lt;br /&gt;
====Setting up bones====&lt;br /&gt;
One of the new features in the subpart animation system is the ability to position subparts to a bone instead of specifying the position in x,y,z coordinates. This will make it a lot simpler to place the subparts. In order to use this, the base model must be exported with the bones, and each subpart model must have its anchor point at the 0,0,0 coordinate.&lt;br /&gt;
&lt;br /&gt;
For those who would rather present the data in x,y,z format, this is still possible, and an example of this can be found in the WoodenGate.sbc file.&lt;br /&gt;
&lt;br /&gt;
===Setting up the animations===&lt;br /&gt;
After setting up the subparts it is now logical to set up the animations for each subpart. The animations are reasoned from the anchor point, and support some basic interpolation options. The animation format is kind of complex and supports a lot of options, but it has some limitations as well. See chapter 6. Limitations for more information.&lt;br /&gt;
&lt;br /&gt;
Here is the layout of the SubpartAnimationComponentDefinition:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_SubpartAnimationComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_SubpartAnimationComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;AnimationSequences&amp;gt;&lt;br /&gt;
	&amp;lt;/AnimationSequences&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notice how the SubtypeId is once again the same as in the cubeblock definition.&lt;br /&gt;
====Setting up the Subpart Animations====&lt;br /&gt;
After defining the component, it is time to define the animations that are part of the component. The animations are structured into sequences of animation steps, and each sequence consists of events and animations. The two sequences used in the PalisadeGate look like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence Name=&amp;quot;OpenSequence&amp;quot; WrapMode=&amp;quot;Once&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;0.2&amp;quot; Name=&amp;quot;DoorOpening&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;2.2&amp;quot; Name=&amp;quot;DoorOpened&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    	&amp;lt;Animation Start=&amp;quot;0&amp;quot; End=&amp;quot;2.2&amp;quot;&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;-90&amp;quot; To=&amp;quot;0&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;90&amp;quot; To=&amp;quot;0&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;/Animation&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence Name=&amp;quot;CloseSequence&amp;quot; WrapMode=&amp;quot;Once&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;0.2&amp;quot; Name=&amp;quot;DoorClosing&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;2.2&amp;quot; Name=&amp;quot;DoorClosed&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    	&amp;lt;Animation Start=&amp;quot;0&amp;quot; End=&amp;quot;2.2&amp;quot;&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;0&amp;quot; To=&amp;quot;-90&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;0&amp;quot; To=&amp;quot;90&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;/Animation&amp;gt;&lt;br /&gt;
&amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Each animation sequence can contain 0 or more events and 0 or more animations. The total duration of a sequence is calculated from either the last finishing animation or the last event. Each animation is executed parallel to the other animation, and if an animation finishes, its effect is applied for the whole remaining duration of the animation.&lt;br /&gt;
&lt;br /&gt;
Each animation contains 0 or more subpart instructions. Each subpart instruction specifies the subpart it will be affecting, the type of animation (Rotation or Translation), the axis on which it operates, the from and to values, and finally the animation method. For more information on the animation methods, look at Appendix A: Interpolation Equations.&lt;br /&gt;
====Setting up animation events====&lt;br /&gt;
As mentioned before, it is possible to set up animation events. Certain entity components will be listening to them and acting upon them being fired, and it is even possible for ModAPI to connect to these events through the code. Each event is simply a point in time during the animation and a name.&lt;br /&gt;
====Setting up Animation Sound Events====&lt;br /&gt;
One of the entity components that act on animation events is the Animation Event Sound Component. It plays a sound when it receives an event it knows of. Its definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_AnimationEventSoundComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_AnimationEventSoundComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;SoundEvents&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorClosed&amp;quot; Sound=&amp;quot;DoorOpen&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/SoundEvents&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Again the SubtypeId matches that of the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Controlling a new block==&lt;br /&gt;
Having the subparts and animations defined is not enough. The game needs to know how to control them, trigger the right animation at the right time, respond to player interaction, etc.&lt;br /&gt;
===Entity state===&lt;br /&gt;
The next entity component that is needed is the EntityStateComponent. This component is responsible for one thing: Tracking the entity’s state. For a door, there are four states, open, closing, closed, and opening. When a door is open or closed, it is not moving, and it can respond to player interaction. When a door is opening or closing, it is actually moving and it should ignore player input.&lt;br /&gt;
====Setting up entity state====&lt;br /&gt;
The entity state component definition is quite simple. The initial state is defined, and for each possible state, transitions to other states are defined. The whole definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_EntityStateComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_EntityStateComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;InitialState&amp;gt;Open&amp;lt;/InitialState&amp;gt;&lt;br /&gt;
	&amp;lt;States&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Open&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Closing&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Closing&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Closed&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Closed&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Opening&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Opening&amp;quot;&amp;gt;&lt;br /&gt;
    			&amp;lt;Transition&amp;gt;Open&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  	&amp;lt;/State&amp;gt;&lt;br /&gt;
	&amp;lt;/States&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
As usual, SubtypeId is matching the CubeBlock definition. InitialState is the state in which the entity starts, and each state can only transition to the states it lists.&lt;br /&gt;
====Setting up State Animations====&lt;br /&gt;
One of the powerful features of this state system is that it is possible to trigger animations on state transitions. For example, when the gate that starts as open wants to transition to a closed state, it has to transition to the Closing state. When the game detects that the closing state is being transitioned to, it will trigger the appropriate animation. The definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateAnimationComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateAnimationComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Animations&amp;gt;&lt;br /&gt;
  	&amp;lt;Animation State=&amp;quot;Opening&amp;quot; Animation=&amp;quot;OpenSequence&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Animation State=&amp;quot;Closing&amp;quot; Animation=&amp;quot;CloseSequence&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/Animations&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
And as usual, SubtypeId is matching the CubeBlock definition. Each animation we defined, namely OpenSequence and CloseSequence, are triggered when the entity transitions to either the Opening state or the Closing state.&lt;br /&gt;
&lt;br /&gt;
===Setting up interaction===&lt;br /&gt;
Finally, it is time to set up the interaction components. At this point, the most complex definitions have been put in place, and all that remains is connecting it to input and finalizing the last state transitions.&lt;br /&gt;
====Use Objects Component====&lt;br /&gt;
First, the use objects component has to be set up. This component enables the game to interact with the use object dummies on the cube block, and it looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_UseObjectsComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_UseObjectsComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;LoadFromModel&amp;gt;false&amp;lt;/LoadFromModel&amp;gt;&lt;br /&gt;
	&amp;lt;UseObjects&amp;gt;&lt;br /&gt;
  		&amp;lt;UseObject Dummy=&amp;quot;detector_gate_01&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_02&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_03&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_04&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/UseObjects&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Like all the previous definitions, SubtypeId must match the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each use object listed is created in the model, and it has to have a name that follows a strict format. The name must start with detector_, followed by a unique name. Then, the Name tag specifies the name of the use object type to use, which in this case is Generic for each of the door’s detector dummies.&lt;br /&gt;
&lt;br /&gt;
Make sure that LoadFromModel is set to false, or the dummies will not behave appropriately.&lt;br /&gt;
&lt;br /&gt;
Normally, the dummy name by itself determines the type of use object that is selected for the object. Inventory for example would be called detector_inventory, and the game would automatically figure out that the desired effect is inventory. The Name attribute overrides the chosen use object, and was added for legacy block support.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that there is a possibility that in the future this system will be altered. Right now it is working in a somewhat obtuse manner and there are future plans for changing this, however, for now it functions like this.&lt;br /&gt;
&lt;br /&gt;
====State Use Object Component====&lt;br /&gt;
The state use object component is the meat of the interaction. It is quite complex to set up and contains many settings. Once it is understood however, it is not so difficult. It looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateUseObjectComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateUseObjectComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Tooltip&amp;gt;UseObject_DynamicPressAndHold&amp;lt;/Tooltip&amp;gt;&lt;br /&gt;
	&amp;lt;PrimaryAction&amp;gt;Manipulate&amp;lt;/PrimaryAction&amp;gt;&lt;br /&gt;
	&amp;lt;SecondaryAction&amp;gt;OpenTerminal&amp;lt;/SecondaryAction&amp;gt;&lt;br /&gt;
	&amp;lt;SupportsAccessSettings&amp;gt;true&amp;lt;/SupportsAccessSettings&amp;gt;&lt;br /&gt;
	&amp;lt;UseObjectTransitionTriggers&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_01&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_01&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_02&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_02&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_03&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_03&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_04&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_04&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/UseObjectTransitionTriggers&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Naturally, SubtypeId is the same as the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
First, the Tooltip field is displayed to the player when they aim at a dummy. The one used here is a formatted one that creates a message informing the player that they can tap to open the door, and hold to edit the permissions.&lt;br /&gt;
&lt;br /&gt;
Next, PrimaryAction determines the tap interaction. In this case, it will perform the manipulation action which triggers one of the use object transition triggers.&lt;br /&gt;
&lt;br /&gt;
The SecondaryAction determines the alternative interaction, in this case it will open the configuration contextual menu.&lt;br /&gt;
&lt;br /&gt;
SupportsAccessSettings determines whether or not this block will respect access rights.&lt;br /&gt;
&lt;br /&gt;
Finally, there is a list of UseObjectTransitionTriggers. Each trigger has a couple of fields. First, Dummy is the name of the dummy as specified in the UseObjectsComponent. Next, the From field indicates what the current EntityState must be for this one to be considered. Then, the To field indicates which state the EntityStateComponent must transition to when it is triggered by the primary action. Then, ActionName and SecondaryActionName are the texts put into the tooltip when the player aims at the block and observes the possible actions.&lt;br /&gt;
====Setting up Animation Event State Transition Component====&lt;br /&gt;
The last component in the chain is the AnimationEventStateTransitionComponent. This component enables the entity to trigger state transitions based on animation events. It is formatted quite similar to the AnimationEventSoundComponent and looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_AnimationEventStateTransitionComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_AnimationEventStateTransitionComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Events&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorClosed&amp;quot; TransitionToState=&amp;quot;Closed&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorOpened&amp;quot; TransitionToState=&amp;quot;Open&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/Events&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As always, SubtypeId is the same as the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each event lists the event name, and the state to transition to.&lt;br /&gt;
&lt;br /&gt;
====Setting up State Timer Component====&lt;br /&gt;
A bonus component that exists in the system is the StateTimerComponent. It is not actually used in any of the doors, but it could be used for automated state transitions. It is easily possible, for example, to make a door that closes itself after 10 seconds. Its definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateTimerComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateTimerComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;StateTimers&amp;gt;&lt;br /&gt;
  		&amp;lt;Timer From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; Delay=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/StateTimers&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It goes without saying that once again the SubtypeId must match the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
The StateTimerComponent can list as many timers as is desired, in this block’s case though, just making it close after 10 seconds is a good enough example. Each timer has a From field, which is the entity state that triggers it, To indicates which state to transition to, and Delay is, in seconds, the delay before it is triggered.&lt;br /&gt;
&lt;br /&gt;
==Tying it all together==&lt;br /&gt;
Finally, after all the components are defined, it is time to set up the entity container. The entity container defines which components make up an entity.&lt;br /&gt;
===Setting up the entity container===&lt;br /&gt;
In the entity container, we must specify which entity components are on the entity.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;EntityContainers&amp;gt;&lt;br /&gt;
	&amp;lt;Container&amp;gt;&lt;br /&gt;
  		&amp;lt;Id&amp;gt;&lt;br /&gt;
    			&amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlock&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
    			&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;/Id&amp;gt;&lt;br /&gt;
  		&amp;lt;DefaultComponents&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_MedievalGridOwnershipComponent&amp;quot;/&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AccessPermissionComponent&amp;quot;/&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_UseObjectsComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_SubpartAnimationComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_CubeBlockSubpartComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_EntityStateComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_StateAnimationComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_StateUseObjectComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AnimationEventStateTransitionComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AnimationEventSoundComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;/DefaultComponents&amp;gt;&lt;br /&gt;
	&amp;lt;/Container&amp;gt;&lt;br /&gt;
  &amp;lt;/EntityContainers&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Last but not least, even here, the SubtypeId is identical to the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each Component in the DefaultComponents list has a BuilderType, which must match the TypeId of the entity component, it has a SubtypeId, which is the same SubtypeId as, you guessed it, the CubeBlock definition, and a ForceCreate=”true” field.&lt;br /&gt;
===Testing it out in the game===&lt;br /&gt;
Now that all the elements are properly defined, the block should function in the game. Launch it, add the mod to the world, make sure it is set to offline if it is not uploaded to steam, then load the save and open the g-screen. It should be possible to search for the block and place it.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
===Animation System===&lt;br /&gt;
One of the limitations of the animation system is that each animation is played from the anchor point. Anchor points are a fixed coordinate and cannot move. They also do not support child bones. This means that it is not possible to make animations that have a subpart be a child part of another subpart.&lt;br /&gt;
==Appendix A: Interpolation equations==&lt;br /&gt;
The supported interpolation equations have been obtained from this website:&lt;br /&gt;
[http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html Tweener Documentation]&lt;br /&gt;
&lt;br /&gt;
It also provides a visual display of the interpolation style, though there are two sets that we do not fully support from the definitions at this time.&lt;br /&gt;
&lt;br /&gt;
The full list:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Animation style&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| Linear&lt;br /&gt;
| Fully supported. Usually boring visually.&lt;br /&gt;
|-&lt;br /&gt;
| QuadraticEaseIn, QuadraticEaseOut, QuadraticEaseInOut, QuadraticEaseOutIn&lt;br /&gt;
| Fully supported. Usually visually most pleasing effect.&lt;br /&gt;
|-&lt;br /&gt;
| CubicEaseIn, CubicEaseOut, CubicEaseInOut, CubicEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| QuarticEaseIn, QuarticEaseOut, QuarticEaseInOut, QuarticEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| QuinticEaseIn, QuinticEaseOut, QuinticEaseInOut, QuinticEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| SinusoidalEaseIn, SinusoidalEaseOut, SinusoidalEaseInOut, SinusoidalEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| ExponentialEaseIn, ExponentialEaseOut, ExponentialEaseInOut, ExponentialEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| CircularEaseIn, CircularEaseOut, CircularEaseInOut, CircularEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| ElasticEaseIn, ElasticEaseOut, ElasticEaseInOut, ElasticEaseOutIn&lt;br /&gt;
| Partially supported, it is currently not possible to specify the period and amplitude parameters.&lt;br /&gt;
|-&lt;br /&gt;
| BackEaseIn, BackEaseOut, BackEaseInOut, BackEaseOutIn&lt;br /&gt;
| Partially supported, it is currently not possible to specify the overshoot parameter.&lt;br /&gt;
|-&lt;br /&gt;
| BounceEaseIn, BounceEaseOut, BounceEaseInOut, BounceEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Appendix B: ModAPI interfaces==&lt;br /&gt;
There are three ModAPI interfaces currently available for interacting with the entity components.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please be aware these interfaces are liable to change in the future!&#039;&#039;&#039;&lt;br /&gt;
===IMyCubeBlockSubpartComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public interface IMyCubeBlockSubpartComponent&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Tries to get a subpart by name.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;subpart&amp;quot;&amp;gt;Output of the subpart&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if subpart exists, false otherwise&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpart(string name, out VRage.ModAPI.IMyEntity subpart);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the transformation of a subpart, relative to its hinge position or bone.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;subpartName&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;translation&amp;quot;&amp;gt;Translation of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;orientation&amp;quot;&amp;gt;Orientation of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;False if the specified subpart is not found, true otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartTransformation(string subpartName, Vector3 translation, Quaternion orientation);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Get the subpart visibility state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isVisible&amp;quot;&amp;gt;Visible or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpartVisibility(string name, out bool isVisible);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the subpart visibility state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isVisible&amp;quot;&amp;gt;Visible or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart visibility was changed, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartVisibility(string name, bool isVisible);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Get the subpart physics enabled state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isPhysicsEnabled&amp;quot;&amp;gt;Physics enabled or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpartPhysicsEnabled(string name, out bool isPhysicsEnabled);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the subpart physics enabled state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isPhysicsEnabled&amp;quot;&amp;gt;Physics enabled or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart Physics was changed, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartPhysicsEnabled(string name, bool isPhysicsEnabled);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===IMyEntityStateComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public delegate void OnStateChangedDelegate(string oldState, string newState);&lt;br /&gt;
&lt;br /&gt;
public interface IMyEntityStateComponent&lt;br /&gt;
{&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// The state the entity is currently in.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	string CurrentState { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Transition to another state.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;newState&amp;quot;&amp;gt;The new state to transition to.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;returns&amp;gt;False if transition failed, true otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
    	bool TransitionTo(string newState);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Registers the passed function as a callback to be called when the state is changed&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void RegisterForStateChange(Medieval.ModAPI.Components.Entity.OnStateChangedDelegate eventDelegate);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Unregisters the passed function as a callback to be called when the state is changed&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void UnregisterForStateChange(Medieval.ModAPI.Components.Entity.OnStateChangedDelegate eventDelegate);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===IMySubpartAnimationComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public interface IMySubpartAnimationComponent&lt;br /&gt;
{&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Playback speed of the animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float PlaybackSpeed { get; set; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Name of the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	string ActiveAnimation { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Progress, in seconds, through the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float ActiveAnimationTime { get; set; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Duration, in seconds, of the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float ActiveAnimationDuration { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Plays the specified animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the animation to play.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;time&amp;quot;&amp;gt;The time of the animation to start at.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;returns&amp;gt;True if the animation was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
    	bool PlayAnimation(string name, float time = 0);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Checks if an animation is playing. If the name parameter is specified, checks if that animation is playing.&lt;br /&gt;
    	/// If the name parameter is empty, checks if any animation is playing.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	bool IsPlayingAnimation(string name = null);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Stops the animation. If the name parameter is specified, it checks if that animation is playing and stops it.&lt;br /&gt;
    	/// If the name parameter is empty it stops the current animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void StopAnimation(string name = null);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Registers the passed function as a callback to be called when an event is triggered.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void RegisterForEvents(Medieval.ModAPI.Components.Entity.OnEventTriggeredDelegate eventDelegate);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Unregisters the passed function as a callback to be called when an event is triggered.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void UnregisterForEvents(Medieval.ModAPI.Components.Entity.OnEventTriggeredDelegate eventDelegate);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Subpart_Animation_System&amp;diff=340</id>
		<title>Keen:Subpart Animation System</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Subpart_Animation_System&amp;diff=340"/>
		<updated>2017-02-01T21:22:56Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: Removed Page Breaks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Outline==&lt;br /&gt;
As of version 0.4.0 we introduced the new subpart animation system. The new subpart animation system allows modders to create animations on any cube block. It is no longer required to make any animated block a MyMedievalDoor block. The new system is a lot more powerful than the old system and will allow a lot more creative freedom and expansion.&lt;br /&gt;
&lt;br /&gt;
It is recommended to no longer use MyMedievalDoor for block animations. It is now deprecated and will be going away eventually.&lt;br /&gt;
&lt;br /&gt;
In this document the new system is explained. First, there will be an overview of the new components we have added. After that, the document will explain more in-depth how to create a new block. Finally, the interaction of players with the block will be explained, both through scripting and through ModAPI.&lt;br /&gt;
&lt;br /&gt;
For any questions regarding this guide it is recommended to ask the community on the forum or Discord. Asking a Medieval Engineers programmer is also an option, if this option is available to the reader.&lt;br /&gt;
&lt;br /&gt;
==Block components overview==&lt;br /&gt;
In this chapter the components involved in the subpart animations are defined. For each component a short description will be given, explaining its purpose and reason for existence. The designer is able to custom-tailer the behaviour of their block through specifying which components they want. Some components require other components to be there, but the designer is otherwise free to do what they believe they need.&lt;br /&gt;
===MyCubeBlockSubpartsComponent===&lt;br /&gt;
This is the root component for the entire system. The subpart component defines what subparts exist on the block’s model. It also loads and stores subpart states between game saves, as well as synchronizes the subpart states over the network. This component allows designers to specify the subparts for the cubeblocks.&lt;br /&gt;
&lt;br /&gt;
All the other subpart affecting components require this component to be present on the cubeblock, they will throw an error if added without this component present.&lt;br /&gt;
===MySubpartAnimationComponent===&lt;br /&gt;
This component defines the animations for the subparts. It is able to create animation sequences, perform subpart rotation and translation, and trigger animation events. The animations can use various interpolation curves, see “Appendix A: Interpolation equations” for more information. This component is also responsible for loading and storing the currently active animation for game saves, as well as synchronizing the active animation over the network.&lt;br /&gt;
&lt;br /&gt;
This component allows designers to specify the animations for the cubeblocks.&lt;br /&gt;
&lt;br /&gt;
It requires the MyCubeBlockSubpartsComponent to be present on the cubeblock to function.&lt;br /&gt;
===MyEntityStateComponent===&lt;br /&gt;
This component defines entity states. While the component itself is very simple, its functionality is actually really powerful. It is a basic state machine. It is possible to set up states and the possible transitions to other states. It triggers an event whenever the state is changed, and it is possible for other components to listen to this. This component allows designers to set up entity states for their blocks, which other components and scripts can respond to.&lt;br /&gt;
===MyAnimationEventSoundComponent===&lt;br /&gt;
This component can respond to animation events and will be able to play audio upon certain events being triggered. This component allows designers to add sound effects to their animations.&lt;br /&gt;
&lt;br /&gt;
It requires the MySubpartAnimationComponent to be present on the cubeblock to function.&lt;br /&gt;
===MyAnimationEventStateTransitionComponent===&lt;br /&gt;
This component is used to trigger entity state transitions when animation events occur. This will allow designers to create more complicated entities and have them reflect their state correctly.&lt;br /&gt;
&lt;br /&gt;
It requires both the MySubpartAnimationComponent and MyEntityStateComponent to be present on the entity to function.&lt;br /&gt;
&lt;br /&gt;
===MyStateAnimationComponent===&lt;br /&gt;
The state animation component listens to state transition events by the MyEntityStateComponent and tells the MySubpartAnimationComponent to start playing animations. It allows the designer to create a block that automatically responds to entity state changes.&lt;br /&gt;
&lt;br /&gt;
This component requires both the MyEntityStateComponent and MySubpartAnimationComponent to be present on the block to function.&lt;br /&gt;
===MyUseObjectsComponent===&lt;br /&gt;
This component simply specifies the use objects available on the entity. Use objects are the elements players can aim at and interact with by pressing their Use key. For this system, all use objects should use the Generic use object.&lt;br /&gt;
&lt;br /&gt;
The MyUseObjectGeneric use object has a public event modders can register to, to receive events whenever the user interacts with the object.&lt;br /&gt;
===MyStateUseObjectComponent===&lt;br /&gt;
The state use object component specifies the actions that can be performed on the object. It will show the player a notification displaying what they can do with this object. It is possible to specify which state transitions are performed when the object is interacted with. This component allows designers to create dynamic use object reactions to their cubeblocks.&lt;br /&gt;
&lt;br /&gt;
Whenever the object is interacted with it will select all possible actions that match the detector name, the current active state, and then it will select the first allowed action. Any other actions that matched the requirements will be ignored.&lt;br /&gt;
&lt;br /&gt;
This component acts as a data interface for the Generic use object. If it is not present, the Generic Use Object will not do anything.&lt;br /&gt;
===MyStateTimerComponent===&lt;br /&gt;
The state timer component is a simple component that listens to state change triggers and will schedule a new transition after a set amount of time. This component allows designers to create objects that perform automatic behaviour, such as a door that closes itself after a few seconds.&lt;br /&gt;
&lt;br /&gt;
This component requires the MyEntityStateComponent to be present to function.&lt;br /&gt;
&lt;br /&gt;
==Creating a new block==&lt;br /&gt;
This chapter will explain the steps required to create a new block. For this purpose, one of the blocks in the game will be used as an example, to showcase all the features that are currently available in the game. If new elements are added in the future, this manual will be updated where applicable.&lt;br /&gt;
&lt;br /&gt;
For the purpose of this document, the block that will be explained is the palisade gate. It is a newly introduced gate block that fits well with the palisade walls. The exact details can be found in ./Content/Data/CubeBlocks/Doors/PalisadeGate.sbc in case more information is required.&lt;br /&gt;
===Setting up cube block definition===&lt;br /&gt;
The first required element for creating a new block is the CubeBlock definition. The CubeBlock definition is the same as it has always been, so setting this one up is pretty simple. The most important thing to take note of here is the SubtypeId value.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;CubeBlocks&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_CubeBlockDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlock&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/CubeBlocks&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Setting up the subparts===&lt;br /&gt;
After setting up the cube block definition, the first new component must be added. This is the CubeBlock Subpart Component, and its definition looks like thus:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_CubeBlockSubpartComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Id&amp;gt;&lt;br /&gt;
    &amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlockSubpartComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
    &amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
  &amp;lt;/Id&amp;gt;&lt;br /&gt;
  &amp;lt;Subparts&amp;gt;&lt;br /&gt;
  &amp;lt;/Subparts&amp;gt;&lt;br /&gt;
&amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The SubtypeId value needs to be identical to the CubeBlock definition, and it is case sensitive.&lt;br /&gt;
&lt;br /&gt;
====Setting up subparts====&lt;br /&gt;
The Palisade Gate has two subparts, the left and right gate. And these need to be defined in the subpart component. This definition goes right after &amp;lt;Subparts&amp;gt; and looks like thus:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  	&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; HingeBone=&amp;quot;PalisadeGateLargeLeft_Pin&amp;quot; RequiresAxialCorrection=&amp;quot;false&amp;quot; HasDummy=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; HingeBone=&amp;quot;PalisadeGateLargeRight_Pin&amp;quot; RequiresAxialCorrection=&amp;quot;false&amp;quot; HasDummy=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
RequiresAxialCorrection is a flag necessary if the doors are not where they were expected to be. Usually, this means that either oriented the block is oriented incorrectly in the 3D editor, or it was exported incorrectly. Axial Correction will invert the Z axis, and swap the X and Y axes. This was necessary for some of the older blocks, as changing them in the editor now would mean all the blocks would rotate in the existing blueprints on the steam workshop.&lt;br /&gt;
&lt;br /&gt;
HasDummy is a new feature, introduced in 0.4.4, where it allows the interaction dummy to move with the moving parts. This provides a more intuitive interaction model, however it has some implementation issues currently, where it does not obey access rights correctly. It is not recommended for blocks that utilize the permissions system.&lt;br /&gt;
====Setting up bones====&lt;br /&gt;
One of the new features in the subpart animation system is the ability to position subparts to a bone instead of specifying the position in x,y,z coordinates. This will make it a lot simpler to place the subparts. In order to use this, the base model must be exported with the bones, and each subpart model must have its anchor point at the 0,0,0 coordinate.&lt;br /&gt;
&lt;br /&gt;
For those who would rather present the data in x,y,z format, this is still possible, and an example of this can be found in the WoodenGate.sbc file.&lt;br /&gt;
&lt;br /&gt;
===Setting up the animations===&lt;br /&gt;
After setting up the subparts it is now logical to set up the animations for each subpart. The animations are reasoned from the anchor point, and support some basic interpolation options. The animation format is kind of complex and supports a lot of options, but it has some limitations as well. See chapter 6. Limitations for more information.&lt;br /&gt;
&lt;br /&gt;
Here is the layout of the SubpartAnimationComponentDefinition:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_SubpartAnimationComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_SubpartAnimationComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;AnimationSequences&amp;gt;&lt;br /&gt;
	&amp;lt;/AnimationSequences&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notice how the SubtypeId is once again the same as in the cubeblock definition.&lt;br /&gt;
====Setting up the Subpart Animations====&lt;br /&gt;
After defining the component, it is time to define the animations that are part of the component. The animations are structured into sequences of animation steps, and each sequence consists of events and animations. The two sequences used in the PalisadeGate look like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence Name=&amp;quot;OpenSequence&amp;quot; WrapMode=&amp;quot;Once&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;0.2&amp;quot; Name=&amp;quot;DoorOpening&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;2.2&amp;quot; Name=&amp;quot;DoorOpened&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    	&amp;lt;Animation Start=&amp;quot;0&amp;quot; End=&amp;quot;2.2&amp;quot;&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;-90&amp;quot; To=&amp;quot;0&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;90&amp;quot; To=&amp;quot;0&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;/Animation&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence Name=&amp;quot;CloseSequence&amp;quot; WrapMode=&amp;quot;Once&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;0.2&amp;quot; Name=&amp;quot;DoorClosing&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;2.2&amp;quot; Name=&amp;quot;DoorClosed&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    	&amp;lt;Animation Start=&amp;quot;0&amp;quot; End=&amp;quot;2.2&amp;quot;&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;0&amp;quot; To=&amp;quot;-90&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;0&amp;quot; To=&amp;quot;90&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;/Animation&amp;gt;&lt;br /&gt;
&amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Each animation sequence can contain 0 or more events and 0 or more animations. The total duration of a sequence is calculated from either the last finishing animation or the last event. Each animation is executed parallel to the other animation, and if an animation finishes, its effect is applied for the whole remaining duration of the animation.&lt;br /&gt;
&lt;br /&gt;
Each animation contains 0 or more subpart instructions. Each subpart instruction specifies the subpart it will be affecting, the type of animation (Rotation or Translation), the axis on which it operates, the from and to values, and finally the animation method. For more information on the animation methods, look at Appendix A: Interpolation Equations.&lt;br /&gt;
====Setting up animation events====&lt;br /&gt;
As mentioned before, it is possible to set up animation events. Certain entity components will be listening to them and acting upon them being fired, and it is even possible for ModAPI to connect to these events through the code. Each event is simply a point in time during the animation and a name.&lt;br /&gt;
====Setting up Animation Sound Events====&lt;br /&gt;
One of the entity components that act on animation events is the Animation Event Sound Component. It plays a sound when it receives an event it knows of. Its definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_AnimationEventSoundComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_AnimationEventSoundComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;SoundEvents&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorClosed&amp;quot; Sound=&amp;quot;DoorOpen&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/SoundEvents&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Again the SubtypeId matches that of the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Controlling a new block==&lt;br /&gt;
Having the subparts and animations defined is not enough. The game needs to know how to control them, trigger the right animation at the right time, respond to player interaction, etc.&lt;br /&gt;
===Entity state===&lt;br /&gt;
The next entity component that is needed is the EntityStateComponent. This component is responsible for one thing: Tracking the entity’s state. For a door, there are four states, open, closing, closed, and opening. When a door is open or closed, it is not moving, and it can respond to player interaction. When a door is opening or closing, it is actually moving and it should ignore player input.&lt;br /&gt;
====Setting up entity state====&lt;br /&gt;
The entity state component definition is quite simple. The initial state is defined, and for each possible state, transitions to other states are defined. The whole definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_EntityStateComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_EntityStateComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;InitialState&amp;gt;Open&amp;lt;/InitialState&amp;gt;&lt;br /&gt;
	&amp;lt;States&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Open&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Closing&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Closing&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Closed&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Closed&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Opening&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Opening&amp;quot;&amp;gt;&lt;br /&gt;
    			&amp;lt;Transition&amp;gt;Open&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  	&amp;lt;/State&amp;gt;&lt;br /&gt;
	&amp;lt;/States&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
As usual, SubtypeId is matching the CubeBlock definition. InitialState is the state in which the entity starts, and each state can only transition to the states it lists.&lt;br /&gt;
====Setting up State Animations====&lt;br /&gt;
One of the powerful features of this state system is that it is possible to trigger animations on state transitions. For example, when the gate that starts as open wants to transition to a closed state, it has to transition to the Closing state. When the game detects that the closing state is being transitioned to, it will trigger the appropriate animation. The definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateAnimationComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateAnimationComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Animations&amp;gt;&lt;br /&gt;
  	&amp;lt;Animation State=&amp;quot;Opening&amp;quot; Animation=&amp;quot;OpenSequence&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Animation State=&amp;quot;Closing&amp;quot; Animation=&amp;quot;CloseSequence&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/Animations&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
And as usual, SubtypeId is matching the CubeBlock definition. Each animation we defined, namely OpenSequence and CloseSequence, are triggered when the entity transitions to either the Opening state or the Closing state.&lt;br /&gt;
&lt;br /&gt;
===Setting up interaction===&lt;br /&gt;
Finally, it is time to set up the interaction components. At this point, the most complex definitions have been put in place, and all that remains is connecting it to input and finalizing the last state transitions.&lt;br /&gt;
====Use Objects Component====&lt;br /&gt;
First, the use objects component has to be set up. This component enables the game to interact with the use object dummies on the cube block, and it looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_UseObjectsComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_UseObjectsComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;LoadFromModel&amp;gt;false&amp;lt;/LoadFromModel&amp;gt;&lt;br /&gt;
	&amp;lt;UseObjects&amp;gt;&lt;br /&gt;
  		&amp;lt;UseObject Dummy=&amp;quot;detector_gate_01&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_02&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_03&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_04&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/UseObjects&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Like all the previous definitions, SubtypeId must match the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each use object listed is created in the model, and it has to have a name that follows a strict format. The name must start with detector_, followed by a unique name. Then, the Name tag specifies the name of the use object type to use, which in this case is Generic for each of the door’s detector dummies.&lt;br /&gt;
&lt;br /&gt;
Make sure that LoadFromModel is set to false, or the dummies will not behave appropriately.&lt;br /&gt;
&lt;br /&gt;
Normally, the dummy name by itself determines the type of use object that is selected for the object. Inventory for example would be called detector_inventory, and the game would automatically figure out that the desired effect is inventory. The Name attribute overrides the chosen use object, and was added for legacy block support.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that there is a possibility that in the future this system will be altered. Right now it is working in a somewhat obtuse manner and there are future plans for changing this, however, for now it functions like this.&lt;br /&gt;
&lt;br /&gt;
====State Use Object Component====&lt;br /&gt;
The state use object component is the meat of the interaction. It is quite complex to set up and contains many settings. Once it is understood however, it is not so difficult. It looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateUseObjectComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateUseObjectComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Tooltip&amp;gt;UseObject_DynamicPressAndHold&amp;lt;/Tooltip&amp;gt;&lt;br /&gt;
	&amp;lt;PrimaryAction&amp;gt;Manipulate&amp;lt;/PrimaryAction&amp;gt;&lt;br /&gt;
	&amp;lt;SecondaryAction&amp;gt;OpenTerminal&amp;lt;/SecondaryAction&amp;gt;&lt;br /&gt;
	&amp;lt;SupportsAccessSettings&amp;gt;true&amp;lt;/SupportsAccessSettings&amp;gt;&lt;br /&gt;
	&amp;lt;UseObjectTransitionTriggers&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_01&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_01&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_02&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_02&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_03&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_03&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_04&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_04&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/UseObjectTransitionTriggers&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Naturally, SubtypeId is the same as the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
First, the Tooltip field is displayed to the player when they aim at a dummy. The one used here is a formatted one that creates a message informing the player that they can tap to open the door, and hold to edit the permissions.&lt;br /&gt;
&lt;br /&gt;
Next, PrimaryAction determines the tap interaction. In this case, it will perform the manipulation action which triggers one of the use object transition triggers.&lt;br /&gt;
&lt;br /&gt;
The SecondaryAction determines the alternative interaction, in this case it will open the configuration contextual menu.&lt;br /&gt;
&lt;br /&gt;
SupportsAccessSettings determines whether or not this block will respect access rights.&lt;br /&gt;
&lt;br /&gt;
Finally, there is a list of UseObjectTransitionTriggers. Each trigger has a couple of fields. First, Dummy is the name of the dummy as specified in the UseObjectsComponent. Next, the From field indicates what the current EntityState must be for this one to be considered. Then, the To field indicates which state the EntityStateComponent must transition to when it is triggered by the primary action. Then, ActionName and SecondaryActionName are the texts put into the tooltip when the player aims at the block and observes the possible actions.&lt;br /&gt;
====Setting up Animation Event State Transition Component====&lt;br /&gt;
The last component in the chain is the AnimationEventStateTransitionComponent. This component enables the entity to trigger state transitions based on animation events. It is formatted quite similar to the AnimationEventSoundComponent and looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_AnimationEventStateTransitionComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_AnimationEventStateTransitionComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Events&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorClosed&amp;quot; TransitionToState=&amp;quot;Closed&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorOpened&amp;quot; TransitionToState=&amp;quot;Open&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/Events&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As always, SubtypeId is the same as the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each event lists the event name, and the state to transition to.&lt;br /&gt;
&lt;br /&gt;
====Setting up State Timer Component====&lt;br /&gt;
A bonus component that exists in the system is the StateTimerComponent. It is not actually used in any of the doors, but it could be used for automated state transitions. It is easily possible, for example, to make a door that closes itself after 10 seconds. Its definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateTimerComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateTimerComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;StateTimers&amp;gt;&lt;br /&gt;
  		&amp;lt;Timer From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; Delay=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/StateTimers&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It goes without saying that once again the SubtypeId must match the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
The StateTimerComponent can list as many timers as is desired, in this block’s case though, just making it close after 10 seconds is a good enough example. Each timer has a From field, which is the entity state that triggers it, To indicates which state to transition to, and Delay is, in seconds, the delay before it is triggered.&lt;br /&gt;
&lt;br /&gt;
==Tying it all together==&lt;br /&gt;
Finally, after all the components are defined, it is time to set up the entity container. The entity container defines which components make up an entity.&lt;br /&gt;
===Setting up the entity container===&lt;br /&gt;
In the entity container, we must specify which entity components are on the entity.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;EntityContainers&amp;gt;&lt;br /&gt;
	&amp;lt;Container&amp;gt;&lt;br /&gt;
  		&amp;lt;Id&amp;gt;&lt;br /&gt;
    			&amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlock&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
    			&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;/Id&amp;gt;&lt;br /&gt;
  		&amp;lt;DefaultComponents&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_MedievalGridOwnershipComponent&amp;quot;/&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AccessPermissionComponent&amp;quot;/&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_UseObjectsComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_SubpartAnimationComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_CubeBlockSubpartComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_EntityStateComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_StateAnimationComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_StateUseObjectComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AnimationEventStateTransitionComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AnimationEventSoundComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;/DefaultComponents&amp;gt;&lt;br /&gt;
	&amp;lt;/Container&amp;gt;&lt;br /&gt;
  &amp;lt;/EntityContainers&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Last but not least, even here, the SubtypeId is identical to the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each Component in the DefaultComponents list has a BuilderType, which must match the TypeId of the entity component, it has a SubtypeId, which is the same SubtypeId as, you guessed it, the CubeBlock definition, and a ForceCreate=”true” field.&lt;br /&gt;
===Testing it out in the game===&lt;br /&gt;
Now that all the elements are properly defined, the block should function in the game. Launch it, add the mod to the world, make sure it is set to offline if it is not uploaded to steam, then load the save and open the g-screen. It should be possible to search for the block and place it.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
===Animation System===&lt;br /&gt;
One of the limitations of the animation system is that each animation is played from the anchor point. Anchor points are a fixed coordinate and cannot move. They also do not support child bones. This means that it is not possible to make animations that have a subpart be a child part of another subpart.&lt;br /&gt;
==Appendix A: Interpolation equations==&lt;br /&gt;
The supported interpolation equations have been obtained from this website:&lt;br /&gt;
[http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html]&lt;br /&gt;
&lt;br /&gt;
It also provides a visual display of the interpolation style, though there are two sets that we do not fully support from the definitions at this time.&lt;br /&gt;
&lt;br /&gt;
The full list:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Animation style&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| Linear&lt;br /&gt;
| Fully supported. Usually boring visually.&lt;br /&gt;
|-&lt;br /&gt;
| QuadraticEaseIn, QuadraticEaseOut, QuadraticEaseInOut, QuadraticEaseOutIn&lt;br /&gt;
| Fully supported. Usually visually most pleasing effect.&lt;br /&gt;
|-&lt;br /&gt;
| CubicEaseIn, CubicEaseOut, CubicEaseInOut, CubicEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| QuarticEaseIn, QuarticEaseOut, QuarticEaseInOut, QuarticEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| QuinticEaseIn, QuinticEaseOut, QuinticEaseInOut, QuinticEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| SinusoidalEaseIn, SinusoidalEaseOut, SinusoidalEaseInOut, SinusoidalEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| ExponentialEaseIn, ExponentialEaseOut, ExponentialEaseInOut, ExponentialEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| CircularEaseIn, CircularEaseOut, CircularEaseInOut, CircularEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| ElasticEaseIn, ElasticEaseOut, ElasticEaseInOut, ElasticEaseOutIn&lt;br /&gt;
| Partially supported, it is currently not possible to specify the period and amplitude parameters.&lt;br /&gt;
|-&lt;br /&gt;
| BackEaseIn, BackEaseOut, BackEaseInOut, BackEaseOutIn&lt;br /&gt;
| Partially supported, it is currently not possible to specify the overshoot parameter.&lt;br /&gt;
|-&lt;br /&gt;
| BounceEaseIn, BounceEaseOut, BounceEaseInOut, BounceEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|}&lt;br /&gt;
==Appendix B: ModAPI interfaces==&lt;br /&gt;
There are three ModAPI interfaces currently available for interacting with the entity components.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please be aware these interfaces are liable to change in the future!&#039;&#039;&#039;&lt;br /&gt;
===IMyCubeBlockSubpartComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public interface IMyCubeBlockSubpartComponent&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Tries to get a subpart by name.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;subpart&amp;quot;&amp;gt;Output of the subpart&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if subpart exists, false otherwise&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpart(string name, out VRage.ModAPI.IMyEntity subpart);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the transformation of a subpart, relative to its hinge position or bone.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;subpartName&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;translation&amp;quot;&amp;gt;Translation of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;orientation&amp;quot;&amp;gt;Orientation of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;False if the specified subpart is not found, true otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartTransformation(string subpartName, Vector3 translation, Quaternion orientation);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Get the subpart visibility state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isVisible&amp;quot;&amp;gt;Visible or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpartVisibility(string name, out bool isVisible);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the subpart visibility state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isVisible&amp;quot;&amp;gt;Visible or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart visibility was changed, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartVisibility(string name, bool isVisible);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Get the subpart physics enabled state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isPhysicsEnabled&amp;quot;&amp;gt;Physics enabled or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpartPhysicsEnabled(string name, out bool isPhysicsEnabled);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the subpart physics enabled state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isPhysicsEnabled&amp;quot;&amp;gt;Physics enabled or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart Physics was changed, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartPhysicsEnabled(string name, bool isPhysicsEnabled);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===IMyEntityStateComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public delegate void OnStateChangedDelegate(string oldState, string newState);&lt;br /&gt;
&lt;br /&gt;
public interface IMyEntityStateComponent&lt;br /&gt;
{&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// The state the entity is currently in.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	string CurrentState { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Transition to another state.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;newState&amp;quot;&amp;gt;The new state to transition to.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;returns&amp;gt;False if transition failed, true otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
    	bool TransitionTo(string newState);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Registers the passed function as a callback to be called when the state is changed&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void RegisterForStateChange(Medieval.ModAPI.Components.Entity.OnStateChangedDelegate eventDelegate);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Unregisters the passed function as a callback to be called when the state is changed&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void UnregisterForStateChange(Medieval.ModAPI.Components.Entity.OnStateChangedDelegate eventDelegate);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===IMySubpartAnimationComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public interface IMySubpartAnimationComponent&lt;br /&gt;
{&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Playback speed of the animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float PlaybackSpeed { get; set; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Name of the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	string ActiveAnimation { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Progress, in seconds, through the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float ActiveAnimationTime { get; set; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Duration, in seconds, of the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float ActiveAnimationDuration { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Plays the specified animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the animation to play.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;time&amp;quot;&amp;gt;The time of the animation to start at.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;returns&amp;gt;True if the animation was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
    	bool PlayAnimation(string name, float time = 0);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Checks if an animation is playing. If the name parameter is specified, checks if that animation is playing.&lt;br /&gt;
    	/// If the name parameter is empty, checks if any animation is playing.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	bool IsPlayingAnimation(string name = null);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Stops the animation. If the name parameter is specified, it checks if that animation is playing and stops it.&lt;br /&gt;
    	/// If the name parameter is empty it stops the current animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void StopAnimation(string name = null);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Registers the passed function as a callback to be called when an event is triggered.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void RegisterForEvents(Medieval.ModAPI.Components.Entity.OnEventTriggeredDelegate eventDelegate);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Unregisters the passed function as a callback to be called when an event is triggered.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void UnregisterForEvents(Medieval.ModAPI.Components.Entity.OnEventTriggeredDelegate eventDelegate);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Keen:Subpart_Animation_System&amp;diff=339</id>
		<title>Keen:Subpart Animation System</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Keen:Subpart_Animation_System&amp;diff=339"/>
		<updated>2017-02-01T21:21:19Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: Corrected outline.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Outline==&lt;br /&gt;
As of version 0.4.0 we introduced the new subpart animation system. The new subpart animation system allows modders to create animations on any cube block. It is no longer required to make any animated block a MyMedievalDoor block. The new system is a lot more powerful than the old system and will allow a lot more creative freedom and expansion.&lt;br /&gt;
&lt;br /&gt;
It is recommended to no longer use MyMedievalDoor for block animations. It is now deprecated and will be going away eventually.&lt;br /&gt;
&lt;br /&gt;
In this document the new system is explained. First, there will be an overview of the new components we have added. After that, the document will explain more in-depth how to create a new block. Finally, the interaction of players with the block will be explained, both through scripting and through ModAPI.&lt;br /&gt;
&lt;br /&gt;
For any questions regarding this guide it is recommended to ask the community on the forum or Discord. Asking a Medieval Engineers programmer is also an option, if this option is available to the reader.&lt;br /&gt;
�&lt;br /&gt;
&lt;br /&gt;
==Block components overview==&lt;br /&gt;
In this chapter the components involved in the subpart animations are defined. For each component a short description will be given, explaining its purpose and reason for existence. The designer is able to custom-tailer the behaviour of their block through specifying which components they want. Some components require other components to be there, but the designer is otherwise free to do what they believe they need.&lt;br /&gt;
===MyCubeBlockSubpartsComponent===&lt;br /&gt;
This is the root component for the entire system. The subpart component defines what subparts exist on the block’s model. It also loads and stores subpart states between game saves, as well as synchronizes the subpart states over the network. This component allows designers to specify the subparts for the cubeblocks.&lt;br /&gt;
&lt;br /&gt;
All the other subpart affecting components require this component to be present on the cubeblock, they will throw an error if added without this component present.&lt;br /&gt;
===MySubpartAnimationComponent===&lt;br /&gt;
This component defines the animations for the subparts. It is able to create animation sequences, perform subpart rotation and translation, and trigger animation events. The animations can use various interpolation curves, see “Appendix A: Interpolation equations” for more information. This component is also responsible for loading and storing the currently active animation for game saves, as well as synchronizing the active animation over the network.&lt;br /&gt;
&lt;br /&gt;
This component allows designers to specify the animations for the cubeblocks.&lt;br /&gt;
&lt;br /&gt;
It requires the MyCubeBlockSubpartsComponent to be present on the cubeblock to function.&lt;br /&gt;
===MyEntityStateComponent===&lt;br /&gt;
This component defines entity states. While the component itself is very simple, its functionality is actually really powerful. It is a basic state machine. It is possible to set up states and the possible transitions to other states. It triggers an event whenever the state is changed, and it is possible for other components to listen to this. This component allows designers to set up entity states for their blocks, which other components and scripts can respond to.&lt;br /&gt;
===MyAnimationEventSoundComponent===&lt;br /&gt;
This component can respond to animation events and will be able to play audio upon certain events being triggered. This component allows designers to add sound effects to their animations.&lt;br /&gt;
&lt;br /&gt;
It requires the MySubpartAnimationComponent to be present on the cubeblock to function.&lt;br /&gt;
===MyAnimationEventStateTransitionComponent===&lt;br /&gt;
This component is used to trigger entity state transitions when animation events occur. This will allow designers to create more complicated entities and have them reflect their state correctly.&lt;br /&gt;
&lt;br /&gt;
It requires both the MySubpartAnimationComponent and MyEntityStateComponent to be present on the entity to function.&lt;br /&gt;
�&lt;br /&gt;
===MyStateAnimationComponent===&lt;br /&gt;
The state animation component listens to state transition events by the MyEntityStateComponent and tells the MySubpartAnimationComponent to start playing animations. It allows the designer to create a block that automatically responds to entity state changes.&lt;br /&gt;
&lt;br /&gt;
This component requires both the MyEntityStateComponent and MySubpartAnimationComponent to be present on the block to function.&lt;br /&gt;
===MyUseObjectsComponent===&lt;br /&gt;
This component simply specifies the use objects available on the entity. Use objects are the elements players can aim at and interact with by pressing their Use key. For this system, all use objects should use the Generic use object.&lt;br /&gt;
&lt;br /&gt;
The MyUseObjectGeneric use object has a public event modders can register to, to receive events whenever the user interacts with the object.&lt;br /&gt;
===MyStateUseObjectComponent===&lt;br /&gt;
The state use object component specifies the actions that can be performed on the object. It will show the player a notification displaying what they can do with this object. It is possible to specify which state transitions are performed when the object is interacted with. This component allows designers to create dynamic use object reactions to their cubeblocks.&lt;br /&gt;
&lt;br /&gt;
Whenever the object is interacted with it will select all possible actions that match the detector name, the current active state, and then it will select the first allowed action. Any other actions that matched the requirements will be ignored.&lt;br /&gt;
&lt;br /&gt;
This component acts as a data interface for the Generic use object. If it is not present, the Generic Use Object will not do anything.&lt;br /&gt;
===MyStateTimerComponent===&lt;br /&gt;
The state timer component is a simple component that listens to state change triggers and will schedule a new transition after a set amount of time. This component allows designers to create objects that perform automatic behaviour, such as a door that closes itself after a few seconds.&lt;br /&gt;
&lt;br /&gt;
This component requires the MyEntityStateComponent to be present to function.&lt;br /&gt;
�&lt;br /&gt;
==Creating a new block==&lt;br /&gt;
This chapter will explain the steps required to create a new block. For this purpose, one of the blocks in the game will be used as an example, to showcase all the features that are currently available in the game. If new elements are added in the future, this manual will be updated where applicable.&lt;br /&gt;
&lt;br /&gt;
For the purpose of this document, the block that will be explained is the palisade gate. It is a newly introduced gate block that fits well with the palisade walls. The exact details can be found in ./Content/Data/CubeBlocks/Doors/PalisadeGate.sbc in case more information is required.&lt;br /&gt;
===Setting up cube block definition===&lt;br /&gt;
The first required element for creating a new block is the CubeBlock definition. The CubeBlock definition is the same as it has always been, so setting this one up is pretty simple. The most important thing to take note of here is the SubtypeId value.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;CubeBlocks&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_CubeBlockDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlock&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/CubeBlocks&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Setting up the subparts===&lt;br /&gt;
After setting up the cube block definition, the first new component must be added. This is the CubeBlock Subpart Component, and its definition looks like thus:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_CubeBlockSubpartComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Id&amp;gt;&lt;br /&gt;
    &amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlockSubpartComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
    &amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
  &amp;lt;/Id&amp;gt;&lt;br /&gt;
  &amp;lt;Subparts&amp;gt;&lt;br /&gt;
  &amp;lt;/Subparts&amp;gt;&lt;br /&gt;
&amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The SubtypeId value needs to be identical to the CubeBlock definition, and it is case sensitive.&lt;br /&gt;
&lt;br /&gt;
====Setting up subparts====&lt;br /&gt;
The Palisade Gate has two subparts, the left and right gate. And these need to be defined in the subpart component. This definition goes right after &amp;lt;Subparts&amp;gt; and looks like thus:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  	&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; HingeBone=&amp;quot;PalisadeGateLargeLeft_Pin&amp;quot; RequiresAxialCorrection=&amp;quot;false&amp;quot; HasDummy=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; HingeBone=&amp;quot;PalisadeGateLargeRight_Pin&amp;quot; RequiresAxialCorrection=&amp;quot;false&amp;quot; HasDummy=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
RequiresAxialCorrection is a flag necessary if the doors are not where they were expected to be. Usually, this means that either oriented the block is oriented incorrectly in the 3D editor, or it was exported incorrectly. Axial Correction will invert the Z axis, and swap the X and Y axes. This was necessary for some of the older blocks, as changing them in the editor now would mean all the blocks would rotate in the existing blueprints on the steam workshop.&lt;br /&gt;
&lt;br /&gt;
HasDummy is a new feature, introduced in 0.4.4, where it allows the interaction dummy to move with the moving parts. This provides a more intuitive interaction model, however it has some implementation issues currently, where it does not obey access rights correctly. It is not recommended for blocks that utilize the permissions system.&lt;br /&gt;
====Setting up bones====&lt;br /&gt;
One of the new features in the subpart animation system is the ability to position subparts to a bone instead of specifying the position in x,y,z coordinates. This will make it a lot simpler to place the subparts. In order to use this, the base model must be exported with the bones, and each subpart model must have its anchor point at the 0,0,0 coordinate.&lt;br /&gt;
&lt;br /&gt;
For those who would rather present the data in x,y,z format, this is still possible, and an example of this can be found in the WoodenGate.sbc file.&lt;br /&gt;
&lt;br /&gt;
�&lt;br /&gt;
===Setting up the animations===&lt;br /&gt;
After setting up the subparts it is now logical to set up the animations for each subpart. The animations are reasoned from the anchor point, and support some basic interpolation options. The animation format is kind of complex and supports a lot of options, but it has some limitations as well. See chapter 6. Limitations for more information.&lt;br /&gt;
&lt;br /&gt;
Here is the layout of the SubpartAnimationComponentDefinition:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_SubpartAnimationComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_SubpartAnimationComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;AnimationSequences&amp;gt;&lt;br /&gt;
	&amp;lt;/AnimationSequences&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notice how the SubtypeId is once again the same as in the cubeblock definition.&lt;br /&gt;
====Setting up the Subpart Animations====&lt;br /&gt;
After defining the component, it is time to define the animations that are part of the component. The animations are structured into sequences of animation steps, and each sequence consists of events and animations. The two sequences used in the PalisadeGate look like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence Name=&amp;quot;OpenSequence&amp;quot; WrapMode=&amp;quot;Once&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;0.2&amp;quot; Name=&amp;quot;DoorOpening&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;2.2&amp;quot; Name=&amp;quot;DoorOpened&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    	&amp;lt;Animation Start=&amp;quot;0&amp;quot; End=&amp;quot;2.2&amp;quot;&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;-90&amp;quot; To=&amp;quot;0&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;90&amp;quot; To=&amp;quot;0&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;/Animation&amp;gt;&lt;br /&gt;
  &amp;lt;/Sequence&amp;gt;&lt;br /&gt;
  &amp;lt;Sequence Name=&amp;quot;CloseSequence&amp;quot; WrapMode=&amp;quot;Once&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;0.2&amp;quot; Name=&amp;quot;DoorClosing&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;Event Start=&amp;quot;2.2&amp;quot; Name=&amp;quot;DoorClosed&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    	&amp;lt;Animation Start=&amp;quot;0&amp;quot; End=&amp;quot;2.2&amp;quot;&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeRight&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;0&amp;quot; To=&amp;quot;-90&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
      		&amp;lt;Subpart Name=&amp;quot;PalisadeGateLargeLeft&amp;quot; Type=&amp;quot;Rotation&amp;quot; Axis=&amp;quot;Y&amp;quot; From=&amp;quot;0&amp;quot; To=&amp;quot;90&amp;quot; Method=&amp;quot;QuadraticEaseInOut&amp;quot; /&amp;gt;&lt;br /&gt;
    	&amp;lt;/Animation&amp;gt;&lt;br /&gt;
&amp;lt;/Sequence&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Each animation sequence can contain 0 or more events and 0 or more animations. The total duration of a sequence is calculated from either the last finishing animation or the last event. Each animation is executed parallel to the other animation, and if an animation finishes, its effect is applied for the whole remaining duration of the animation.&lt;br /&gt;
&lt;br /&gt;
Each animation contains 0 or more subpart instructions. Each subpart instruction specifies the subpart it will be affecting, the type of animation (Rotation or Translation), the axis on which it operates, the from and to values, and finally the animation method. For more information on the animation methods, look at Appendix A: Interpolation Equations.&lt;br /&gt;
====Setting up animation events====&lt;br /&gt;
As mentioned before, it is possible to set up animation events. Certain entity components will be listening to them and acting upon them being fired, and it is even possible for ModAPI to connect to these events through the code. Each event is simply a point in time during the animation and a name.&lt;br /&gt;
====Setting up Animation Sound Events====&lt;br /&gt;
One of the entity components that act on animation events is the Animation Event Sound Component. It plays a sound when it receives an event it knows of. Its definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_AnimationEventSoundComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_AnimationEventSoundComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;SoundEvents&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorClosed&amp;quot; Sound=&amp;quot;DoorOpen&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/SoundEvents&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Again the SubtypeId matches that of the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Controlling a new block==&lt;br /&gt;
Having the subparts and animations defined is not enough. The game needs to know how to control them, trigger the right animation at the right time, respond to player interaction, etc.&lt;br /&gt;
===Entity state===&lt;br /&gt;
The next entity component that is needed is the EntityStateComponent. This component is responsible for one thing: Tracking the entity’s state. For a door, there are four states, open, closing, closed, and opening. When a door is open or closed, it is not moving, and it can respond to player interaction. When a door is opening or closing, it is actually moving and it should ignore player input.&lt;br /&gt;
====Setting up entity state====&lt;br /&gt;
The entity state component definition is quite simple. The initial state is defined, and for each possible state, transitions to other states are defined. The whole definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_EntityStateComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_EntityStateComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;InitialState&amp;gt;Open&amp;lt;/InitialState&amp;gt;&lt;br /&gt;
	&amp;lt;States&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Open&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Closing&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Closing&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Closed&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Closed&amp;quot;&amp;gt;&lt;br /&gt;
    	&amp;lt;Transition&amp;gt;Opening&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  		&amp;lt;/State&amp;gt;&lt;br /&gt;
  	&amp;lt;State Name=&amp;quot;Opening&amp;quot;&amp;gt;&lt;br /&gt;
    			&amp;lt;Transition&amp;gt;Open&amp;lt;/Transition&amp;gt;&lt;br /&gt;
  	&amp;lt;/State&amp;gt;&lt;br /&gt;
	&amp;lt;/States&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
As usual, SubtypeId is matching the CubeBlock definition. InitialState is the state in which the entity starts, and each state can only transition to the states it lists.&lt;br /&gt;
====Setting up State Animations====&lt;br /&gt;
One of the powerful features of this state system is that it is possible to trigger animations on state transitions. For example, when the gate that starts as open wants to transition to a closed state, it has to transition to the Closing state. When the game detects that the closing state is being transitioned to, it will trigger the appropriate animation. The definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateAnimationComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  		&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateAnimationComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;PalisadeGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Animations&amp;gt;&lt;br /&gt;
  	&amp;lt;Animation State=&amp;quot;Opening&amp;quot; Animation=&amp;quot;OpenSequence&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Animation State=&amp;quot;Closing&amp;quot; Animation=&amp;quot;CloseSequence&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/Animations&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
And as usual, SubtypeId is matching the CubeBlock definition. Each animation we defined, namely OpenSequence and CloseSequence, are triggered when the entity transitions to either the Opening state or the Closing state.&lt;br /&gt;
&lt;br /&gt;
�&lt;br /&gt;
===Setting up interaction===&lt;br /&gt;
Finally, it is time to set up the interaction components. At this point, the most complex definitions have been put in place, and all that remains is connecting it to input and finalizing the last state transitions.&lt;br /&gt;
====Use Objects Component====&lt;br /&gt;
First, the use objects component has to be set up. This component enables the game to interact with the use object dummies on the cube block, and it looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_UseObjectsComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_UseObjectsComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;LoadFromModel&amp;gt;false&amp;lt;/LoadFromModel&amp;gt;&lt;br /&gt;
	&amp;lt;UseObjects&amp;gt;&lt;br /&gt;
  		&amp;lt;UseObject Dummy=&amp;quot;detector_gate_01&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_02&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_03&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;UseObject Dummy=&amp;quot;detector_gate_04&amp;quot; Name=&amp;quot;Generic&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/UseObjects&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Like all the previous definitions, SubtypeId must match the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each use object listed is created in the model, and it has to have a name that follows a strict format. The name must start with detector_, followed by a unique name. Then, the Name tag specifies the name of the use object type to use, which in this case is Generic for each of the door’s detector dummies.&lt;br /&gt;
&lt;br /&gt;
Make sure that LoadFromModel is set to false, or the dummies will not behave appropriately.&lt;br /&gt;
&lt;br /&gt;
Normally, the dummy name by itself determines the type of use object that is selected for the object. Inventory for example would be called detector_inventory, and the game would automatically figure out that the desired effect is inventory. The Name attribute overrides the chosen use object, and was added for legacy block support.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that there is a possibility that in the future this system will be altered. Right now it is working in a somewhat obtuse manner and there are future plans for changing this, however, for now it functions like this.&lt;br /&gt;
�&lt;br /&gt;
====State Use Object Component====&lt;br /&gt;
The state use object component is the meat of the interaction. It is quite complex to set up and contains many settings. Once it is understood however, it is not so difficult. It looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateUseObjectComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateUseObjectComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Tooltip&amp;gt;UseObject_DynamicPressAndHold&amp;lt;/Tooltip&amp;gt;&lt;br /&gt;
	&amp;lt;PrimaryAction&amp;gt;Manipulate&amp;lt;/PrimaryAction&amp;gt;&lt;br /&gt;
	&amp;lt;SecondaryAction&amp;gt;OpenTerminal&amp;lt;/SecondaryAction&amp;gt;&lt;br /&gt;
	&amp;lt;SupportsAccessSettings&amp;gt;true&amp;lt;/SupportsAccessSettings&amp;gt;&lt;br /&gt;
	&amp;lt;UseObjectTransitionTriggers&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_01&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_01&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_02&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_02&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_03&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Trigger Dummy=&amp;quot;detector_gate_03&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_04&amp;quot; From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; ActionName=&amp;quot;Action_Close&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
  		&amp;lt;Trigger Dummy=&amp;quot;detector_gate_04&amp;quot; From=&amp;quot;Closed&amp;quot; To=&amp;quot;Opening&amp;quot; ActionName=&amp;quot;Action_Open&amp;quot; SecondaryActionName=&amp;quot;Action_Configure&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/UseObjectTransitionTriggers&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Naturally, SubtypeId is the same as the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
First, the Tooltip field is displayed to the player when they aim at a dummy. The one used here is a formatted one that creates a message informing the player that they can tap to open the door, and hold to edit the permissions.&lt;br /&gt;
&lt;br /&gt;
Next, PrimaryAction determines the tap interaction. In this case, it will perform the manipulation action which triggers one of the use object transition triggers.&lt;br /&gt;
&lt;br /&gt;
The SecondaryAction determines the alternative interaction, in this case it will open the configuration contextual menu.&lt;br /&gt;
&lt;br /&gt;
SupportsAccessSettings determines whether or not this block will respect access rights.&lt;br /&gt;
&lt;br /&gt;
Finally, there is a list of UseObjectTransitionTriggers. Each trigger has a couple of fields. First, Dummy is the name of the dummy as specified in the UseObjectsComponent. Next, the From field indicates what the current EntityState must be for this one to be considered. Then, the To field indicates which state the EntityStateComponent must transition to when it is triggered by the primary action. Then, ActionName and SecondaryActionName are the texts put into the tooltip when the player aims at the block and observes the possible actions.&lt;br /&gt;
====Setting up Animation Event State Transition Component====&lt;br /&gt;
The last component in the chain is the AnimationEventStateTransitionComponent. This component enables the entity to trigger state transitions based on animation events. It is formatted quite similar to the AnimationEventSoundComponent and looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_AnimationEventStateTransitionComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_AnimationEventStateTransitionComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;Events&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorClosed&amp;quot; TransitionToState=&amp;quot;Closed&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;Event Name=&amp;quot;DoorOpened&amp;quot; TransitionToState=&amp;quot;Open&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/Events&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As always, SubtypeId is the same as the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each event lists the event name, and the state to transition to.&lt;br /&gt;
&lt;br /&gt;
�&lt;br /&gt;
====Setting up State Timer Component====&lt;br /&gt;
A bonus component that exists in the system is the StateTimerComponent. It is not actually used in any of the doors, but it could be used for automated state transitions. It is easily possible, for example, to make a door that closes itself after 10 seconds. Its definition looks like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;Definition xsi:type=&amp;quot;MyObjectBuilder_StateTimerComponentDefinition&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;Id&amp;gt;&lt;br /&gt;
  	&amp;lt;TypeId&amp;gt;MyObjectBuilder_StateTimerComponent&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
  	&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
	&amp;lt;/Id&amp;gt;&lt;br /&gt;
	&amp;lt;StateTimers&amp;gt;&lt;br /&gt;
  		&amp;lt;Timer From=&amp;quot;Open&amp;quot; To=&amp;quot;Closing&amp;quot; Delay=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/StateTimers&amp;gt;&lt;br /&gt;
  &amp;lt;/Definition&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It goes without saying that once again the SubtypeId must match the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
The StateTimerComponent can list as many timers as is desired, in this block’s case though, just making it close after 10 seconds is a good enough example. Each timer has a From field, which is the entity state that triggers it, To indicates which state to transition to, and Delay is, in seconds, the delay before it is triggered.&lt;br /&gt;
�&lt;br /&gt;
==Tying it all together==&lt;br /&gt;
Finally, after all the components are defined, it is time to set up the entity container. The entity container defines which components make up an entity.&lt;br /&gt;
===Setting up the entity container===&lt;br /&gt;
In the entity container, we must specify which entity components are on the entity.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;EntityContainers&amp;gt;&lt;br /&gt;
	&amp;lt;Container&amp;gt;&lt;br /&gt;
  		&amp;lt;Id&amp;gt;&lt;br /&gt;
    			&amp;lt;TypeId&amp;gt;MyObjectBuilder_CubeBlock&amp;lt;/TypeId&amp;gt;&lt;br /&gt;
    			&amp;lt;SubtypeId&amp;gt;WoodenGate&amp;lt;/SubtypeId&amp;gt;&lt;br /&gt;
  		&amp;lt;/Id&amp;gt;&lt;br /&gt;
  		&amp;lt;DefaultComponents&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_MedievalGridOwnershipComponent&amp;quot;/&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AccessPermissionComponent&amp;quot;/&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_UseObjectsComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_SubpartAnimationComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_CubeBlockSubpartComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_EntityStateComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_StateAnimationComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_StateUseObjectComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AnimationEventStateTransitionComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
    			&amp;lt;Component BuilderType=&amp;quot;MyObjectBuilder_AnimationEventSoundComponent&amp;quot; SubtypeId=&amp;quot;WoodenGate&amp;quot; ForceCreate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
  	&amp;lt;/DefaultComponents&amp;gt;&lt;br /&gt;
	&amp;lt;/Container&amp;gt;&lt;br /&gt;
  &amp;lt;/EntityContainers&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Last but not least, even here, the SubtypeId is identical to the CubeBlock definition.&lt;br /&gt;
&lt;br /&gt;
Each Component in the DefaultComponents list has a BuilderType, which must match the TypeId of the entity component, it has a SubtypeId, which is the same SubtypeId as, you guessed it, the CubeBlock definition, and a ForceCreate=”true” field.&lt;br /&gt;
===Testing it out in the game===&lt;br /&gt;
Now that all the elements are properly defined, the block should function in the game. Launch it, add the mod to the world, make sure it is set to offline if it is not uploaded to steam, then load the save and open the g-screen. It should be possible to search for the block and place it.&lt;br /&gt;
&lt;br /&gt;
�&lt;br /&gt;
==Limitations==&lt;br /&gt;
===Animation System===&lt;br /&gt;
One of the limitations of the animation system is that each animation is played from the anchor point. Anchor points are a fixed coordinate and cannot move. They also do not support child bones. This means that it is not possible to make animations that have a subpart be a child part of another subpart.&lt;br /&gt;
==Appendix A: Interpolation equations==&lt;br /&gt;
The supported interpolation equations have been obtained from this website:&lt;br /&gt;
[http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html]&lt;br /&gt;
&lt;br /&gt;
It also provides a visual display of the interpolation style, though there are two sets that we do not fully support from the definitions at this time.&lt;br /&gt;
&lt;br /&gt;
The full list:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Animation style&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| Linear&lt;br /&gt;
| Fully supported. Usually boring visually.&lt;br /&gt;
|-&lt;br /&gt;
| QuadraticEaseIn, QuadraticEaseOut, QuadraticEaseInOut, QuadraticEaseOutIn&lt;br /&gt;
| Fully supported. Usually visually most pleasing effect.&lt;br /&gt;
|-&lt;br /&gt;
| CubicEaseIn, CubicEaseOut, CubicEaseInOut, CubicEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| QuarticEaseIn, QuarticEaseOut, QuarticEaseInOut, QuarticEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| QuinticEaseIn, QuinticEaseOut, QuinticEaseInOut, QuinticEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| SinusoidalEaseIn, SinusoidalEaseOut, SinusoidalEaseInOut, SinusoidalEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| ExponentialEaseIn, ExponentialEaseOut, ExponentialEaseInOut, ExponentialEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| CircularEaseIn, CircularEaseOut, CircularEaseInOut, CircularEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|-&lt;br /&gt;
| ElasticEaseIn, ElasticEaseOut, ElasticEaseInOut, ElasticEaseOutIn&lt;br /&gt;
| Partially supported, it is currently not possible to specify the period and amplitude parameters.&lt;br /&gt;
|-&lt;br /&gt;
| BackEaseIn, BackEaseOut, BackEaseInOut, BackEaseOutIn&lt;br /&gt;
| Partially supported, it is currently not possible to specify the overshoot parameter.&lt;br /&gt;
|-&lt;br /&gt;
| BounceEaseIn, BounceEaseOut, BounceEaseInOut, BounceEaseOutIn&lt;br /&gt;
| Fully supported.&lt;br /&gt;
|}&lt;br /&gt;
==Appendix B: ModAPI interfaces==&lt;br /&gt;
There are three ModAPI interfaces currently available for interacting with the entity components.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please be aware these interfaces are liable to change in the future!&#039;&#039;&#039;&lt;br /&gt;
===IMyCubeBlockSubpartComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public interface IMyCubeBlockSubpartComponent&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Tries to get a subpart by name.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;subpart&amp;quot;&amp;gt;Output of the subpart&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if subpart exists, false otherwise&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpart(string name, out VRage.ModAPI.IMyEntity subpart);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the transformation of a subpart, relative to its hinge position or bone.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;subpartName&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;translation&amp;quot;&amp;gt;Translation of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;orientation&amp;quot;&amp;gt;Orientation of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;False if the specified subpart is not found, true otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartTransformation(string subpartName, Vector3 translation, Quaternion orientation);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Get the subpart visibility state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isVisible&amp;quot;&amp;gt;Visible or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpartVisibility(string name, out bool isVisible);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the subpart visibility state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isVisible&amp;quot;&amp;gt;Visible or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart visibility was changed, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartVisibility(string name, bool isVisible);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Get the subpart physics enabled state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isPhysicsEnabled&amp;quot;&amp;gt;Physics enabled or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool TryGetSubpartPhysicsEnabled(string name, out bool isPhysicsEnabled);&lt;br /&gt;
&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Sets the subpart physics enabled state.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the subpart.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;param name=&amp;quot;isPhysicsEnabled&amp;quot;&amp;gt;Physics enabled or not.&amp;lt;/param&amp;gt;&lt;br /&gt;
	/// &amp;lt;returns&amp;gt;True if the subpart Physics was changed, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
	bool SetSubpartPhysicsEnabled(string name, bool isPhysicsEnabled);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===IMyEntityStateComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public delegate void OnStateChangedDelegate(string oldState, string newState);&lt;br /&gt;
&lt;br /&gt;
public interface IMyEntityStateComponent&lt;br /&gt;
{&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// The state the entity is currently in.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	string CurrentState { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Transition to another state.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;newState&amp;quot;&amp;gt;The new state to transition to.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;returns&amp;gt;False if transition failed, true otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
    	bool TransitionTo(string newState);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Registers the passed function as a callback to be called when the state is changed&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void RegisterForStateChange(Medieval.ModAPI.Components.Entity.OnStateChangedDelegate eventDelegate);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Unregisters the passed function as a callback to be called when the state is changed&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void UnregisterForStateChange(Medieval.ModAPI.Components.Entity.OnStateChangedDelegate eventDelegate);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===IMySubpartAnimationComponent===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public interface IMySubpartAnimationComponent&lt;br /&gt;
{&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Playback speed of the animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float PlaybackSpeed { get; set; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Name of the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	string ActiveAnimation { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Progress, in seconds, through the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float ActiveAnimationTime { get; set; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Duration, in seconds, of the active animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	float ActiveAnimationDuration { get; }&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Plays the specified animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;name&amp;quot;&amp;gt;Name of the animation to play.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;param name=&amp;quot;time&amp;quot;&amp;gt;The time of the animation to start at.&amp;lt;/param&amp;gt;&lt;br /&gt;
    	/// &amp;lt;returns&amp;gt;True if the animation was found, false otherwise.&amp;lt;/returns&amp;gt;&lt;br /&gt;
    	bool PlayAnimation(string name, float time = 0);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Checks if an animation is playing. If the name parameter is specified, checks if that animation is playing.&lt;br /&gt;
    	/// If the name parameter is empty, checks if any animation is playing.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	bool IsPlayingAnimation(string name = null);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Stops the animation. If the name parameter is specified, it checks if that animation is playing and stops it.&lt;br /&gt;
    	/// If the name parameter is empty it stops the current animation.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void StopAnimation(string name = null);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Registers the passed function as a callback to be called when an event is triggered.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void RegisterForEvents(Medieval.ModAPI.Components.Entity.OnEventTriggeredDelegate eventDelegate);&lt;br /&gt;
&lt;br /&gt;
    	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
    	/// Unregisters the passed function as a callback to be called when an event is triggered.&lt;br /&gt;
    	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
    	void UnregisterForEvents(Medieval.ModAPI.Components.Entity.OnEventTriggeredDelegate eventDelegate);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Keen_Modding_Guides]]&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Main_Page&amp;diff=92</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Main_Page&amp;diff=92"/>
		<updated>2017-01-05T17:11:50Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello, and welcome to Medieval Engineers Official Wiki! Thank you for your contributions. &amp;lt;br&amp;gt;We hope you like the place and decide to stay.&lt;br /&gt;
&lt;br /&gt;
Medieval Engineers is a sandbox game about engineering, construction and the maintenance of architectural&amp;lt;br&amp;gt;&lt;br /&gt;
work and mechanical equipment using medieval technology. Players build cities, castles and fortifications;&amp;lt;br&amp;gt;&lt;br /&gt;
construct mechanical devices and engines; and perform landscaping and underground mining.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Main_Page&amp;diff=91</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Main_Page&amp;diff=91"/>
		<updated>2017-01-05T17:09:19Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello, and welcome to Medieval Engineers Official Wiki! Thank you for your contributions. &amp;lt;br&amp;gt;We hope you like the place and decide to stay.&lt;br /&gt;
&lt;br /&gt;
Medieval Engineers is a sandbox game about engineering, construction and the maintenance of architectural&amp;lt;br&amp;gt;&lt;br /&gt;
work and mechanical equipment using medieval technology. Players build cities, castles and fortifications;&amp;lt;br&amp;gt;&lt;br /&gt;
construct mechanical devices and engines; and perform landscaping and underground mining.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
	<entry>
		<id>https://medievalengineerswiki.com/index.php?title=Main_Page&amp;diff=90</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://medievalengineerswiki.com/index.php?title=Main_Page&amp;diff=90"/>
		<updated>2017-01-05T17:08:42Z</updated>

		<summary type="html">&lt;p&gt;Deepflame: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello, and welcome to Medieval Engineers Official Wiki! Thank you for your contributions. &amp;lt;br&amp;gt;We hope you like the place and decide to stay.&lt;br /&gt;
&lt;br /&gt;
Medieval Engineers is a sandbox game about engineering, construction and the maintenance of architectural&amp;lt;br&amp;gt;&lt;br /&gt;
work and mechanical equipment using medieval technology. Players build cities, castles and fortifications;&amp;lt;br&amp;gt;&lt;br /&gt;
construct mechanical devices and engines; and perform landscaping and underground mining.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
lorem ipsum sit dolor amet or something&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Deepflame</name></author>
	</entry>
</feed>