Skip to content

Commit

Permalink
Merge pull request #2436 from CombatExtended-Continued/AmmoContainer(…
Browse files Browse the repository at this point in the history
…Upstream)

External Ammo Autoloader/Container
  • Loading branch information
N7Huntsman authored Oct 11, 2023
2 parents bffe334 + c1da2a9 commit 8457f99
Show file tree
Hide file tree
Showing 24 changed files with 1,581 additions and 428 deletions.
23 changes: 17 additions & 6 deletions Defs/JobDefs/Jobs_CE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,27 @@
</modExtensions>
</JobDef>

<JobDef>
<defName>GiveAmmo</defName>
<driverClass>CombatExtended.JobDriver_GiveAmmo</driverClass>
<reportString>Giving TargetB to TargetA.</reportString>
</JobDef>

<JobDef>
<defName>RepairNaturalArmor</defName>
<driverClass>CombatExtended.JobDriver_RepairNaturalArmor</driverClass>
<reportString>Fixing TargetA 's natural armor.</reportString>
</JobDef>

<JobDef>
<defName>ReloadAutoLoader</defName>
<driverClass>CombatExtended.JobDriver_ReloadAutoLoader</driverClass>
<reportString>Reloading TargetA with TargetB.</reportString>
<modExtensions>
<li Class="CombatExtended.JobDefExtensionCE">
<isCrouchJob>true</isCrouchJob>
</li>
</modExtensions>
</JobDef>

<JobDef>
<defName>GiveAmmo</defName>
<driverClass>CombatExtended.JobDriver_GiveAmmo</driverClass>
<reportString>Giving TargetB to TargetA.</reportString>
</JobDef>

</Defs>
22 changes: 22 additions & 0 deletions Defs/SoundDefs/AutoLoader_Sustainer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>

<SoundDef>
<defName>CE_AutoLoaderAmbient</defName>
<sustain>True</sustain>
<context>MapOnly</context>
<priorityMode>PrioritizeNearest</priorityMode>
<subSounds>
<li>
<grains>
<li Class="AudioGrain_Clip">
<clipPath>AmmoContainer/AmmoContainerAmbient</clipPath>
</li>
</grains>
<volumeRange>10</volumeRange>
<distRange>10~38</distRange>
</li>
</subSounds>
</SoundDef>

</Defs>
144 changes: 144 additions & 0 deletions Defs/ThingDefs_Buildings/AutoLoaderExample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!--
===Auto loader example def
<ThingDef ParentName="BuildingBase">
<defName>BDsAutoLoaderTest</defName>
<label>auto loader test</label>
<description>An ammo crate with magical autoloaders.</description>
===Thing class, ticker type and drawer type are mandatory===
<thingClass>CombatExtended.Building_AutoLoaderCE</thingClass>
<tickerType>Normal</tickerType>
<drawerType>MapMeshAndRealTime</drawerType>
===This Ammo user is the autoloader's ammo capacity and reload time===
<comps>
<li Class="CombatExtended.CompProperties_AmmoUser">
<magazineSize>400</magazineSize>
<reloadTime>7.8</reloadTime>
<ammoSet>AmmoSet_145x114mm</ammoSet>
</li>
===If CompMannable and CompPowerTrader are present, they'll be taken into account too, same goes for CompInitiatable and CompCanBeDormant===
<li Class="CompProperties_Mannable">
<manWorkType>Hauling</manWorkType>
</li>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>300</basePowerConsumption>
</li>
</comps>
===Different graphics can be applied at empty, half full (above 0) and full (above 75%) if this mod extension exists===
<modExtensions>
<li Class="CombatExtended.ModExtension_AutoLoaderGraphics">
<fullGraphic>
<texPath>Things/Building/Misc/ToolCabinet</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<drawSize>(2,1)</drawSize>
<color>(0,0,0)</color>
<damageData>
<cornerTL>Damage/Corner</cornerTL>
<cornerTR>Damage/Corner</cornerTR>
<cornerBL>Damage/Corner</cornerBL>
<cornerBR>Damage/Corner</cornerBR>
</damageData>
</fullGraphic>
<halfFullGraphic>
===This is left deliberately empty, The code should fall back to default graphic if the current situation's graphics is left blank===
</halfFullGraphic>
<emptyGraphic>
<texPath>Things/Building/Misc/ToolCabinet</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<drawSize>(2,1)</drawSize>
<color>(0,0,114)</color>
<damageData>
<cornerTL>Damage/Corner</cornerTL>
<cornerTR>Damage/Corner</cornerTR>
<cornerBL>Damage/Corner</cornerBL>
<cornerBR>Damage/Corner</cornerBR>
</damageData>
</emptyGraphic>
===Only turrets in this list will be reloaded, if it's not empty===
<allowedTurrets>
<li>Turret_Heavy</li>
</allowedTurrets>
==The tag here is buildingTags under building node, Not weapon tag. See the def of KPV for example
<allowedTurretTags>
<li>CE_TurretHeavy</li>
</allowedTurretTags>
===if left empty, a default machine cranking sound will play===
<reloadingSustainer>Ingest_Drink</reloadingSustainer>
===if left empty, the intereact sound of the turret gun will play===
<reloadCompleteSound>Pawn_Chicken_Call</reloadCompleteSound>
</li>
</modExtensions>
===Generic stuffs here===
<graphicData>
<texPath>Things/Building/Misc/ToolCabinet</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<drawSize>(2,1)</drawSize>
<color>(96,114,95)</color>
<damageData>
<cornerTL>Damage/Corner</cornerTL>
<cornerTR>Damage/Corner</cornerTR>
<cornerBL>Damage/Corner</cornerBL>
<cornerBR>Damage/Corner</cornerBR>
</damageData>
</graphicData>
<altitudeLayer>Building</altitudeLayer>
<passability>PassThroughOnly</passability>
<castEdgeShadows>true</castEdgeShadows>
<staticSunShadowHeight>0.35</staticSunShadowHeight>
<hasInteractionCell>True</hasInteractionCell>
<interactionCellOffset>(0,0,-1)</interactionCellOffset>
<fillPercent>0.5</fillPercent>
<canOverlapZones>false</canOverlapZones>
<pathCost>42</pathCost>
<size>(2,1)</size>
<costList>
<Steel>200</Steel>
</costList>
<building>
<destroySound>BuildingDestroyed_Metal_Small</destroySound>
</building>
<statBases>
<MaxHitPoints>100</MaxHitPoints>
<WorkToBuild>1800</WorkToBuild>
<Mass>20</Mass>
<Flammability>0.5</Flammability>
===Look at this reload speed. this controls how fast/slow autoloader loads===
<ReloadSpeed>0.5</ReloadSpeed>
</statBases>
<designationCategory>Misc</designationCategory>
<minifiedDef>MinifiedThing</minifiedDef>
<thingCategories>
<li>BuildingsMisc</li>
</thingCategories>
</ThingDef>
-->

</Defs>
Loading

0 comments on commit 8457f99

Please sign in to comment.