Skip to content

how to custom your hatch

unisun2 edited this page Aug 10, 2019 · 8 revisions

custom your own Hatch for your turret:

change just texture:

<?xml version="1.0" encoding="UTF-8"?>
<Patch>
  
  <Operation Class="PatchOperationFindMod">
	<mods>
		<li>Ground Turret Mod</li>
	</mods>
	<match Class="PatchOperationSequence">
		<success>Always</success>
		<operations>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName="yourturret1"]/comps</xpath>
			<value>
				<li Class="FP_GTM.CompProperties_FP_GTM_B">
				<CustomxPath>UI/Commands/GTMunburrow change here!</CustomxPath>    <!-- important! -->
				</li>
			</value>
			</li>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName="yourturret2"]/comps</xpath>
			<value>
				<li Class="FP_GTM.CompProperties_FP_GTM_B">
				<CustomxPath>UI/Commands/GTMunburrow change here!</CustomxPath>    <!-- important! -->
				</li>
			</value>
			</li>
			
		</operations>
	</match>
  </Operation>

</Patch>

input this in your mod/Patches. Finish!

custom all of hatch:

1. Make building Def.

2. add comp+@ your turret.

  1. Make building(hatch) Def
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<ThingDef ParentName="BuildingBase" Name="mustchangehere"> <!-- must change here! -->
	<defName>GTM_Hatch</defName> <!-- must change here! -->
    <label>Hatch</label>
    <description>Hide Turret. even smart enemy never know about this.</description>
    <thingClass>FP_GTM.GTM_Hatch</thingClass> <!-- do not change here. -->
    <category>Building</category>
    <altitudeLayer>FloorEmplacement</altitudeLayer>
    <fillPercent>0.2</fillPercent>
    <useHitPoints>true</useHitPoints>
    <stuffCategories>
      <li>Metallic</li>
      <li>Woody</li>
      <li>Stony</li>
    </stuffCategories>
	<costList>
      <ComponentIndustrial>2</ComponentIndustrial>
    </costList>
	<costStuffCount>80</costStuffCount>
    <statBases>
      <MaxHitPoints>300</MaxHitPoints>
      <Flammability>0.5</Flammability>
	  <WorkToBuild>2000</WorkToBuild>
    </statBases>
    <leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
    <selectable>true</selectable>
    <tickerType>Normal</tickerType>
    <rotatable>false</rotatable>
    <soundImpactDefault>BulletImpact_Metal</soundImpactDefault>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <holdsRoof>false</holdsRoof>
    <staticSunShadowHeight>0</staticSunShadowHeight>
    <drawerType>RealtimeOnly</drawerType>
    <building>
			<isInert>true</isInert>
      <ai_chillDestination>false</ai_chillDestination>
    </building>
    <comps>
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>30</basePowerConsumption>
      </li>
      <li Class="CompProperties_Breakdownable"/>
    </comps>
	<passability>Standable</passability>
	<graphicData>
      <texPath>Things/Building/GTM_Hatch</texPath> <!-- plz change here! -->
      <graphicClass>Graphic_Single</graphicClass>
      <damageData>
        <enabled>false</enabled>
      </damageData>
    </graphicData>
  </ThingDef>
  
  <ThingDef ParentName="mustchangehere"> <!-- must change here! -->
  <defName>GTM_Hatch_Bigqwer</defName> <!-- must change here! -->
  <size>(2,2)</size>
  <graphicData>
      <texPath>Things/Building/GTM_Hatch</texPath> <!-- plz change here! -->
      <graphicClass>Graphic_Single</graphicClass>
	  <drawSize>(2, 2)</drawSize>
      <damageData>
        <enabled>false</enabled>
      </damageData>
    </graphicData>
  </ThingDef>
  
  <ThingDef ParentName="mustchangehere"> <!-- must change here! -->
  <defName>GTM_Hatch_XBigqwer</defName> <!-- must change here! -->
  <size>(3,3)</size>
  <graphicData>
      <texPath>Things/Building/GTM_Hatch</texPath> <!-- plz change here! -->
      <graphicClass>Graphic_Single</graphicClass>
	  <drawSize>(3, 3)</drawSize>
      <damageData>
        <enabled>false</enabled>
      </damageData>
    </graphicData>
  </ThingDef>
  
  <ThingDef ParentName="mustchangehere"> <!-- must change here! -->
  <defName>GTM_Hatch_XXBigqwer</defName> <!-- must change here! -->
  <size>(4,4)</size>
  <graphicData>
      <texPath>Things/Building/GTM_Hatch</texPath> <!-- plz change here! -->
      <graphicClass>Graphic_Single</graphicClass>
	  <drawSize>(4, 4)</drawSize>
      <damageData>
        <enabled>false</enabled>
      </damageData>
    </graphicData>
  </ThingDef>


</Defs>

copy this. Change what you want. just don't change thingclass. and save your Def folder.

if you don't need 22 or 33 or 4*4, delete it.

  1. add comp+@ in patch file
<?xml version="1.0" encoding="UTF-8"?>
<Patch>
  
  <Operation Class="PatchOperationFindMod">
	<mods>
		<li>Ground Turret Mod</li>
	</mods>
	<match Class="PatchOperationSequence">
		<success>Always</success>
		<operations>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName="yourturretnameone"]/comps</xpath>
			<value>
				<li Class="FP_GTM.CompProperties_FP_GTM_B">
				<Customhatch>GTM_Hatchqwer</Customhatch> <!-- input your own Hatch's Defname! -->
				</li>
			</value>
			</li>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName="yourturretnametwo"]/comps</xpath>
			<value>
				<li Class="FP_GTM.CompProperties_FP_GTM_B"/> <!-- no custom hatch -->
			</value>
			</li>
			
		</operations>
	</match>
  </Operation>

</Patch>