Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External Ammo Autoloader/Container #2436

Merged
merged 38 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8e1a606
Initial commit
CMDR-Bill-Doors Mar 8, 2023
2bcc00f
Move ammoset check to where it should be
CMDR-Bill-Doors Mar 8, 2023
400b424
fix ammo replacement, yeet compfacility
CMDR-Bill-Doors Mar 8, 2023
cb9c0c8
reload speed affected by ReloadSpeed stat
CMDR-Bill-Doors Mar 8, 2023
e621e0c
Pawn reload containers, reload one at once
CMDR-Bill-Doors Mar 8, 2023
359b892
fixed reloading different ammo for container
CMDR-Bill-Doors Mar 8, 2023
f5b059a
various checks
CMDR-Bill-Doors Mar 8, 2023
8a5c950
job xml
CMDR-Bill-Doors Mar 8, 2023
9f3c8a3
translation keys
CMDR-Bill-Doors Mar 8, 2023
37988a3
example def
CMDR-Bill-Doors Mar 8, 2023
07f34a7
gizmo icons
CMDR-Bill-Doors Mar 8, 2023
9c12308
Make ammo replace even when full
CMDR-Bill-Doors Mar 8, 2023
d150163
variable graphic based on remaining ammo
CMDR-Bill-Doors Mar 8, 2023
d62b220
example def update
CMDR-Bill-Doors Mar 8, 2023
1f259ef
auto turret auto reload from containers
CMDR-Bill-Doors Mar 8, 2023
e756e55
house keeping, and reverted progress bar
CMDR-Bill-Doors Mar 8, 2023
ae548df
No reload when aiming
CMDR-Bill-Doors Mar 8, 2023
3e1449a
Sound effect
CMDR-Bill-Doors Mar 8, 2023
4909509
sound effect (xml)
CMDR-Bill-Doors Mar 8, 2023
e3cd17e
fix save & load problem
CMDR-Bill-Doors Mar 8, 2023
f22b5f2
Merge remote-tracking branch 'upstream/Development' into AmmoContainer
CMDR-Bill-Doors Mar 16, 2023
6ef9657
Merge remote-tracking branch 'upstream/Development' into AmmoContainer
CMDR-Bill-Doors Apr 12, 2023
c325d0e
Merge pull request #2379 from CMDR-Bill-Doors/AmmoContainer
CMDR-Bill-Doors Apr 12, 2023
7852f9e
Merge branch 'Development' into AmmoContainer(Upstream)
CMDR-Bill-Doors Sep 11, 2023
5897d2f
oopsie
CMDR-Bill-Doors Sep 11, 2023
f3368d5
Update AmmoContainerExample.xml
CMDR-Bill-Doors Sep 11, 2023
a380e53
Update AmmoContainerExample.xml
CMDR-Bill-Doors Sep 11, 2023
d5ce830
housekeeping
SamaelGray Sep 11, 2023
a2e5f15
added turret whitelist function
CMDR-Bill-Doors Sep 11, 2023
696bace
Merge branch 'AmmoContainer(Upstream)' of https://github.com/CombatEx…
CMDR-Bill-Doors Sep 11, 2023
c0915ea
blahblah
CMDR-Bill-Doors Sep 19, 2023
56d73d3
building tag support
CMDR-Bill-Doors Oct 4, 2023
b900ae7
Grammar fixes
N7Huntsman Oct 5, 2023
c2e2f52
more keyed revisions
N7Huntsman Oct 5, 2023
37c30c4
rename stuff
CMDR-Bill-Doors Oct 5, 2023
18e0979
additional rename
CMDR-Bill-Doors Oct 5, 2023
b49bf4a
a small optimization
CMDR-Bill-Doors Oct 6, 2023
c1da2a9
typo fix
Thorbane Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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