Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Add Forsakens patches #1208

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Add Forsakens patches #1208

wants to merge 7 commits into from

Conversation

sumghai
Copy link
Contributor

@sumghai sumghai commented Apr 9, 2020

Additions

  • Add compatibility patches for Forsakens, as part of the FastTrack merger
  • Add conditionally-patched mod-unique ammo and projectiles:
    • Forsaken arrow (stats identical to Steel Great Arrows, ammo textures implemented in CE ThirdParty folder, projectile texture directly referenced from original mod)
    • Reskinned projectile variants of 8x35mm Charged cartridge, 12 Gauge Charged shotgun cartridge and 5x35mm Charged cartridge ammo, allowing Forsaken weapons to use generic CE Charged ammo while firing their own projectiles

References

Reasoning

  • Apparel sharp and blunt AP stats balanced to latest CE standards
    • Forsaken fabric apparel are only craftable from Synthread, so stats are based on a normal quality vanilla apparel made from Synthread
    • Forsaken armor comparable to vanilla CE power armor
  • Drug mass and bulk comparable to vanilla CE drugs
  • All Forsaken pawn inventory comes with 6~8 magazines for their weapon, as they only spawn with firearms
  • Nightling animal stats based on a mix of Wargs and AnimalCollabProj Dire Wolves
  • Forsaken weapon stats based on various other vanilla CE or third-party mod patch stats
    • See comments in xml file for specific justifications
  • Black Hydra weapon currently disabled for CE, as original mod had it defined with thingDef instead of ThingDef, which is incompatible with CE's PatchOperationMakeGunCECompatible

Testing

Check tests you have performed:

  • Game runs without errors
  • (For compatibility patches) ...with and without patched mod loaded
  • Playtested a colony (12 hours)

@sumghai sumghai requested review from a team as code owners April 9, 2020 13:11
@sumghai sumghai mentioned this pull request Apr 9, 2020
35 tasks
Copy link
Contributor

@N7Huntsman N7Huntsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the Forsaken ammo is functionally identical to various core ammo sets, would it be more practical to set those respective ammos as the Parent, rather than using the generic ammo parent? If it works, it would prevent any need to have to manually adjust the stats of the Forsaken-specific ammo in the event that the core ammo stats were tweaked.

Copy link
Contributor

@N7Huntsman N7Huntsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the Forsaken ammo is functionally identical to various core ammo sets, would it be more practical to set those respective ammos as the Parent, rather than using the generic ammo parent? If it works, it would prevent any need to have to manually adjust the stats of the Forsaken-specific ammo in the event that the core ammo stats were tweaked.

@sumghai
Copy link
Contributor Author

sumghai commented Apr 10, 2020

If the Forsaken ammo is functionally identical to various core ammo sets, would it be more practical to set those respective ammos as the Parent, rather than using the generic ammo parent? If it works, it would prevent any need to have to manually adjust the stats of the Forsaken-specific ammo in the event that the core ammo stats were tweaked.

I tried using non-abstract generic CE projectile defs as the Parents for the Forsaken projectiles, in the hopes that stats would be inherited as you suggested, but this resulted in errors in the debug log - probably because the game doesn't like inheriting from non-abstract defs:

Attempted optimization of Forsaken arrows
<?xml version="1.0" encoding="UTF-8"?>
<Patch>
	<Operation Class="PatchOperationFindMod">
		<mods>
			<li>Forsakens</li>
		</mods>
		<match Class="PatchOperationSequence">
			<operations>

				<li Class="PatchOperationAdd">
					<xpath>Defs</xpath>
					<value>

						<!-- There is only one type of Forsaken arrow, no subcategory for variants required -->

						<!--==================== AmmoSet ========================== -->

						<CombatExtended.AmmoSetDef>
							<defName>AmmoSet_ForsakensArrows</defName>
							<label>forsakens arrows</label>
							<ammoTypes>
								<Ammo_ForsakensArrows>Projectile_ForsakensArrows</Ammo_ForsakensArrows>
							</ammoTypes>
						</CombatExtended.AmmoSetDef>

						<!--==================== Ammo ========================== -->
						
						<!-- Stats inherited from generic CE steel great arrows -->

						<ThingDef Class="CombatExtended.AmmoDef" ParentName="Ammo_GreatArrow_Steel">
							<defName>Ammo_ForsakensArrows</defName>
							<label>forsakens arrow</label>
							<description>Heavy arrow designed to be fired from a forsaken bow.</description>
							<graphicData>
								<texPath>ThirdParty/Forsakens/FAmmoArrow</texPath>
								<graphicClass>Graphic_StackCount</graphicClass>
							</graphicData>
							<statBases>
								<Flammability>0</Flammability>
							</statBases>
							<ammoClass>ForsakenArrow</ammoClass>
						</ThingDef>

						<!-- ================== Projectiles ================== -->
						
						<!-- Stats inherited from generic CE steel great arrows -->

						<ThingDef Class="CombatExtended.AmmoDef" ParentName="Projectile_GreatArrow_Steel">
							<defName>Projectile_ForsakensArrows</defName>
							<label>forsakens arrow</label>
							<graphicData>
								<texPath>Weapons/FArrow</texPath>
								<graphicClass>Graphic_Single</graphicClass>
							</graphicData>
							<projectile Class="CombatExtended.ProjectilePropertiesCE">
								<preExplosionSpawnThingDef>Ammo_ForsakensArrows</preExplosionSpawnThingDef>
							</projectile>
						</ThingDef>

						<!-- ==================== Recipes ========================== -->

						<RecipeDef ParentName="AmmoRecipeNeolithicBase">
							<defName>MakeAmmo_ForsakensArrows</defName>
							<label>make forsakens arrows x10</label>
							<description>Craft 10 forsakens arrows.</description>
							<jobString>Making forsaken arrows.</jobString>
							<workAmount>400</workAmount>
							<ingredients>
								<!-- Stats manually specified due to alien nature of ammo -->
								<li>
									<filter>
										<thingDefs>
											<li>Steel</li>
										</thingDefs>
									</filter>
									<count>4</count>
								</li>
							</ingredients>
							<fixedIngredientFilter>
								<thingDefs>
									<li>Steel</li>
								</thingDefs>
							</fixedIngredientFilter>
							<products>
								<Ammo_ForsakensArrows>10</Ammo_ForsakensArrows>
							</products>
						</RecipeDef>

					</value>
				</li>

			</operations>
		</match>
	</Operation>
</Patch>
Attempted optimization of Reskinned charged projectiles
<?xml version="1.0" encoding="UTF-8"?>
<Patch>
	<Operation Class="PatchOperationFindMod">
		<mods>
			<li>Forsakens</li>
		</mods>
		<match Class="PatchOperationSequence">
			<operations>

				<!-- Custom ammoset and projectile definitions for Forsaken ranged weapons, allowing them to use reskinned versions of generic CE charged ammo while keeping the same stats -->

				<li Class="PatchOperationAdd">
					<xpath>Defs</xpath>
					<value>

						<!-- ========== 8x35mm Charged cartridge for Forsaken Sniping Rifle ========== -->

						<CombatExtended.AmmoSetDef>
							<defName>AmmoSet_8x35mmCharged_ForsakenSniper</defName>
							<label>8x35mm Charged</label>
							<ammoTypes>
								<Ammo_8x35mmCharged>Bullet_8x35mmCharged_ForsakenSniper</Ammo_8x35mmCharged>
							</ammoTypes>
						</CombatExtended.AmmoSetDef>
						
						<ThingDef Class="CombatExtended.AmmoDef" ParentName="Bullet_8x35mmCharged">
							<defName>Bullet_8x35mmCharged_ForsakenSniper</defName>
							<label>8x35mm Charged bullet</label>
							<graphicData>
								<texPath>Weapons/SnipPulse</texPath>
								<graphicClass>Graphic_Single</graphicClass>
							</graphicData>
						</ThingDef>

						<!-- ========== 12 Gauge Charged shotgun cartridge for Forsaken ShotGun ========== -->

						<CombatExtended.AmmoSetDef>
							<defName>AmmoSet_12GaugeCharged_ForsakenShotGun</defName>
							<label>12 Gauge Charged</label>
							<ammoTypes>
								<Ammo_12GaugeCharged>Bullet_12GaugeCharged_ForsakenShotGun</Ammo_12GaugeCharged>
							</ammoTypes>
						</CombatExtended.AmmoSetDef>

						<!-- Original mod implemented the shotgun blast as a slug -->
						<ThingDef Class="CombatExtended.AmmoDef" ParentName="Bullet_12GaugeCharged_Slug">
							<defName>Bullet_12GaugeCharged_ForsakenShotGun</defName>
							<label>charge shot pellet</label>
							<graphicData>
								<texPath>Weapons/ShotPulse</texPath>
								<graphicClass>Graphic_Single</graphicClass>
							</graphicData>
						</ThingDef>

						<!-- ========== 5x35mm Charged cartridge for Forsaken Assault Rifle ========== -->

						<CombatExtended.AmmoSetDef>
							<defName>AmmoSet_5x35mmCharged_ForsakenAR</defName>
							<label>5x35mm Charged</label>
							<ammoTypes>
								<Ammo_5x35mmCharged>Bullet_5x35mmCharged_ForsakenAR</Ammo_5x35mmCharged>
							</ammoTypes>
						</CombatExtended.AmmoSetDef>
						
						<ThingDef Class="CombatExtended.AmmoDef" ParentName="Bullet_5x35mmCharged">
							<defName>Bullet_5x35mmCharged_ForsakenAR</defName>
							<label>5x35mm Charged bullet</label>
							<graphicData>
								<texPath>Weapons/SmolPulse</texPath>
								<graphicClass>Graphic_Single</graphicClass>
								<drawSize>(1,1)</drawSize>
							</graphicData>
						</ThingDef>

					</value>
				</li>

			</operations>
		</match>
	</Operation>
</Patch>
Screenshot of debug log at startup

Annotation 2020-04-10 201011

I'll see if there are other ways I can optimize ammo def inheritance, but my experience with other conditionally-patched mod-unique ammo suggests this would be highly unlikely.

@sumghai
Copy link
Contributor Author

sumghai commented Apr 10, 2020

The most optimization I can do ammo-wise would be to have the Forsaken arrow ammo item inherit from the generic CE AmmoGreatArrowBase def, although stats still need to be explicitly defined in accordance with an actual steel great arrow (3d46dac).

I'll take a look at some of the other problems now.

@sumghai sumghai requested a review from N7Huntsman April 10, 2020 14:06
<!-- NOTE: Black Hydra is currently disabled for CE, as the original mod incorrectly uses a thingDef rather than ThingDef, which is incompatible with CE patching -->

<li Class="PatchOperationRemove">
<xpath>Defs/ThingDef[defName="ForsakenHydra"]</xpath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch currently fails, needs to the thingDef.

<li Class="PatchOperationReplace">
<xpath>Defs/AlienRace.ThingDef_AlienRace[defName="Alien_Forsaken"]/tools</xpath>
<value>
<tools>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They'll need a HeadAttackTool to prevent weird AI behavior in the event they lose both of their arms.

<value>
<tools>
<li Class="CombatExtended.ToolCE">
<label>left fist</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, your melee attack labels aren't working. Attacks are being logged as "forsaken Left/Right claw."

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants