Modding SOS (SOS Addons)

 Modding SOS

 In this guide we'll learn how to implement New Ship Weapons. Getting started=

Getting started

You will need a text editor like Notepad++ or simply Notepad.

You will need to get the Local Copy of SOS from your Steam or GOG folder: How To Get Mods Offline

You will also need a copy of the free audio editing program Audacity (even if you own Sony Sound Forge or Adobe Audition, Audacity saves the OGG format correctly.)

And you will need either the free program GIMP or Adobe Photoshop.

Get these programs ready to go, and prepare your art assets. :)

Download Save Our Ship Creation Kit: Workshop

Install the SOSCK and activate it in your mod manager. This will help you test your maps/ships. Follow the SOSCK Guide here: SOSCK Guide

At the end, you can use this tool to make your own ships, featuring your new weapons!

Getting started |    New Weapons -->

Weapon Art Assets=

Weapon Art Assets

Weapon Art
All Ship Weapons are made of 3 sprites:

A Turret Top The Turret that rotates to look around and fire. A Hardpoint The base of the turret that goes under the head. A Build Menu Icon The icon shown in the architect menu.

All Three of these textures live here---

Weapon Textures Paths: \RimWorld\Mods\Save Our Ship\Textures\Things\Building\Ship

You should match the dimensions of the existing Small (2x2) Large (3x3) or Capital (5x5) turret resolutions.

All the turrets are 512x512 resolution. The Turret has a head that rotates in a circle to aim, and the Hardpoint which goes underneath it. The basic SOS turrets are Red, Yellow, Blue, and Green to help quickly visually identify them and set them apart. Your turret may differ.

You can grab the Hardpoint from the Small, Large or Capital Cannons and simply change the hue and saturation of the yellow to whatever color you like in a program like GIMP or Photoshop.

Here is an excellent art guide by Oskar Potocki about making art for RimWorld: https://www.youtube.com/watch?v=Ncyy-FYxHn4

A Projectile The bullet you see leave the turret when fired.

You'll also need a unique Projectile, found in this folder: \RimWorld\Mods\Save Our Ship\Textures\Things\Projectile

<-- Getting Started |    Weapon Code -->

Weapon Code=

Weapon Code

Weapon Code
You will find Ship Weapons under the ThingDefs_Buildings folder in the Buildings_ShipCombat.xml.

File path \RimWorld\Mods\Save Our Ship\1.2\Defs\ThingDefs_Buildings\Buildings_ShipCombat.xml

Let's assume you are building only regular turrets for now, nothing fancy.

Lets dig into each section of your New Weapon XML.

1 ) Buildings Dropdown Menu 

  YOUR_WEAPON_NAME 

Your Weapon can be added to a dropdown menu that contains all your ship weapons, small, medium, and large. If your weapon only has 1 size, you can skip this step.

1 ) Thing Defs 

 YOUR_WEAPON_NAME ;; This is your ship's definition. Choose a consistent name! You'll use it a lot. cannon turret ;; This is the name you will see in game. YOUR_WEAPON_NAME ;; this is how you assign your turret to the dropdown we set above. This is the lengthy text description of your ship turret that will appear in game in the info tab. <li Class="CompProperties_ShipHeat"> <compClass>CompShipHeatSource</compClass> <heatPerPulse>100</heatPerPulse> ;; this is your heat generated when it fires. <energyToFire>100</energyToFire> ;; the energy cost to fire. <maxRange>50</maxRange> ;; tells when the weapon can fire on the ruler. 50 is shorter than laser, 280 is railgun range. <projectileSpeed>4</projectileSpeed> ;; 4 is default, leave this alone <pointDefense>true</pointDefense> ;; can your weapon shoot down torpedoes? False is no. 10 ;; Adds to your Combat Rating. 10 is a small turret, 30 a large, 100 a spinal. </li> <li Class="CompProperties_Power"> <compClass>CompPowerTrader</compClass> <basePowerConsumption>100</basePowerConsumption> ;; the power it consumes when idle. <transmitsPower>true</transmitsPower> </li> <li Class="CompProperties_Refuelable"> <fuelLabel>Shots until rearm</fuelLabel> <fuelGizmoLabel>Uranium slugs</fuelGizmoLabel> ;; the name of your ammo <outOfFuelMessage>Cannot shoot: No slugs</outOfFuelMessage> <fuelFilter><thingDefs><li>Uranium</li></thingDefs></fuelFilter> ;; the defname of the type of ammo it takes. <fuelCapacity>25</fuelCapacity> ;; Ammo Magazine size. <fuelMultiplier>0.5</fuelMultiplier> <initialFuelPercent>1</initialFuelPercent> ;; how much ammo does it start with? <autoRefuelPercent>0.5</autoRefuelPercent> ;; when do pawns automatically refill? <showFuelGizmo>true</showFuelGizmo> <minimumFueledThreshold>1</minimumFueledThreshold> <consumeFuelOnlyWhenUsed>true</consumeFuelOnlyWhenUsed> <fuelIconPath>UI/Overlays/Barrel</fuelIconPath> </li> <li Class="CompProperties_Flickable" /> <terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>

Your weapons major stats, including ammo

<h4 class="headline-table-h4">2 ) Turret Top Art And Data <pre style="white-space:pre-line !important;">

<turretGunDef>YOUR_WEAPON_NAME_Top</turretGunDef> ;;The name of the top of your turret. <buildingTags> </buildingTags> <turretBurstWarmupTime>0.5</turretBurstWarmupTime> ;; The time between shooting and aiming <turretBurstCooldownTime>10.0</turretBurstCooldownTime> ;; How fast does each burst take to fire? 10 is fast. 100 is very slow. Number of shots is down below. <turretTopDrawSize>3</turretTopDrawSize> ;; This tells us this turret building is 3x3 <costList> <Steel>100</Steel> <Uranium>50</Uranium> <Plasteel>80</Plasteel> <ComponentSpacer>2</ComponentSpacer> </costList> <uiIconPath>Things/Building/Ship/YOUR_WEAPON_NAME_MenuIcon</uiIconPath> ;;The file name of your Build Menu Icon <researchPrerequisites> <li>YOUR_WEAPON_RESEARCH_NAME</li> ;; This is set in your unique research definition XML. ShipTurretMedium or ShipTurretLarge for bigs ones. </researchPrerequisites> <altitudeLayer>WorldClipper</altitudeLayer> </ThingDef>

The above set the Shot Burst Timing and Research type required to build this weapon. (Number of shots fired pur-burst is down below.)

<h4 class="headline-table-h4">3 ) Turret In Game Info <pre style="white-space:pre-line !important;">  <ThingDef ParentName="BaseShipArtilleryWeapon">    YOUR_WEAPON_NAME_Top</defName>    you_weapon_name ;; the name of your ship weapon in game    Ship cannon. Best used at X range.     <graphicData>      <texPath>Things/Building/Ship/YOUR_WEAPON_NAME</texPath> ;; PNG file of your turret top    </graphicData>    <weaponTags>    </weaponTags>      <li>        shoot slug         <verbClass>Verb_LaunchProjectileShip</verbClass>        <hasStandardCommand>true</hasStandardCommand>        12.9 ;; not used in game        <warmupTime>0.5</warmupTime>		<burstShotCount>8</burstShotCount> ;; the number of times the weapons fires -- usually only 1        <noiseRadius>10</noiseRadius>        <ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>        <soundCast>YOUR_WEAPON_SOUNDFX_NAME</soundCast> ;; This is where you add your sound FX        <requireLineOfSight>false</requireLineOfSight> <targetParams> <canTargetLocations>true</canTargetLocations> </targetParams> <defaultProjectile>Bullet_Fake_YOUR_WEAPON_NAME</defaultProjectile> ;; Name this "fake buellet" later <spawnDef>Proj_ShipTurret_YOUR_WEAPON_NAME</spawnDef> ;; You need to name your projectile this name in another XML <rangedFireRulepack>Combat_RangedFire_Thrown</rangedFireRulepack> </li> </ThingDef>

Above you've set your SoundFX, named in another XML, your Projectile Art Name, set in another XML. You've also named your "Fake Bullet" that will fires on your ship map, before it appears on the enemy map.

You also set your Burst Count here, for the number of shots fired.

<h4 class="headline-table-h4">4 ) Projectiles <pre style="white-space:pre-line !important;">

<ThingDef ParentName="BaseBullet"> Bullet_Fake_YOUR_WEAPON_NAME</defName> YOUR_WEAPON_NAME slug ;; name your projectile's name <graphicData> <texPath>Things/Projectile/YOUR_WEAPON_NAME_PROJECTILE</texPath> ;; texture path to the projectile you will fire <graphicClass>Graphic_Single</graphicClass> <shaderType>TransparentPostLight</shaderType> <drawSize>(2,2)</drawSize> </graphicData> <thingClass>Bullet</thingClass> <damageDef>Bomb</damageDef> 140 ;; how fast should this bullet fly off your map and onto the other? <explosionRadius>0</explosionRadius> ;; 0 is small, 1.9 to 2.9 is laser sized, 8.9 is really big, 6.9 breaks your pc     <flyOverhead>true</flyOverhead> <soundHitThickRoof>Artillery_HitThickRoof</soundHitThickRoof> </ThingDef> <ThingDef ParentName="BaseGrenadeProjectile"> Proj_YOUR_WEAPON_NAME</defName> ;; name this again as it hits the enemy map YOUR_WEAPON_NAME Slug ;; name this again for the enemy map <thingClass>Projectile_ExplosiveShipCombat</thingClass> <graphicData> <texPath>Things/Projectile/YOUR_WEAPON_NAME_PROJECTILE</texPath> ;; name this again for the enemy map <graphicClass>Graphic_Single</graphicClass> <shaderType>TransparentPostLight</shaderType> <drawSize>(2,2)</drawSize> </graphicData> <explosionRadius>0</explosionRadius> ;;0 is small, 1.9 to 2.9 is laser sized, 8.9 is really big, 6.9 breaks your pc     <damageDef>BombKinetic</damageDef> ;; if you wrote a custom explosion it lives here, othrewise use vanilla bomb 140 ;; how fast does it enter the enemy map? </ThingDef>

This is where you set the projectiles leaving the turet's map and going to the enemy map. Set explosion size, speed of the projectile, and size of the projectile art.

<h4 class="headline-table-h4">5 ) Explosion <pre style="white-space:pre-line !important;">

<DamageDef Name="Bomb_YOUR_WEAPON_NAME"> ;; Name your bomb. Bomb_YOUR_WEAPON_NAME</defName> ;; the name of the explosion we'll use for our weapon. bomb <workerClass>DamageWorker_AddInjury</workerClass> <externalViolence>true</externalViolence> <isExplosive>true</isExplosive> <deathMessage>{0} has died in an explosion.</deathMessage> Shredded <hediffSolid>Crack</hediffSolid> <harmAllLayersUntilOutside>true</harmAllLayersUntilOutside> <impactSoundType>Blunt</impactSoundType> <armorCategory>Sharp</armorCategory> <minDamageToFragment>15</minDamageToFragment> <defaultDamage>220</defaultDamage> ;; thisis the true damage of your weapon's impact. Based on 1000HP hull tiles. <defaultStoppingPower>1</defaultStoppingPower> <defaultArmorPenetration>0.5</defaultArmorPenetration> <buildingDamageFactor>4</buildingDamageFactor> <plantDamageFactor>4</plantDamageFactor> <explosionAffectOutsidePartsOnly>false</explosionAffectOutsidePartsOnly> <explosionHeatEnergyPerCell>5</explosionHeatEnergyPerCell> <explosionCellMote>Mote_BlastDry</explosionCellMote> <explosionColorCenter>(1, 0.5, 0.3)</explosionColorCenter> <explosionColorEdge>(0.6, 0.5, 0.4)</explosionColorEdge> <soundExplosion>Explosion_Bomb</soundExplosion> <combatLogRules>Damage_Bomb</combatLogRules> </DamageDef>

Above, set the explosion radius and power.

<-- Weapon Art Assets |    Research -->

Research=

Research

Your new Research topic will need to live in: RimWorld\Mods\Save Our Ship\1.2\Defs\ResearchProjectDefs

<h4 class="headline-table-h4">1 )Research <pre style="white-space:pre-line !important;"> <Defs>	<ResearchProjectDef ParentName="ShipResearchProjectBase">		ShipTurret_YOUR_WEAPON_NAME</defName>		 ship cannons 		 Describe your weapon and what it does! 		<baseCost>800</baseCost>		<techLevel>Spacer</techLevel>			<li>ShipBasics</li> ;; unlocks as soon as ships are available.		 ResearchTabShip 		<researchViewX>4</researchViewX>		<researchViewY>4</researchViewY>	</ResearchProjectDef>	</Defs>

You may want to set your turret to: ShipTurretMedium or ShipTurretLarge, if you want them to be large or capitol cannons. ShipBasics unlocks as soon as ships are available.

I you don't want the player to be able to research this at all, simply remove all research prerequisites. You can then add this weapon to your ship only in dev mode, useful for building enemy ships with the SOSCK.

<-- Weapon Code |    SoundFX -->

New SoundFX=

New SoundFX

Sound files live here: RimWorld\Mods\Save Our Ship\1.2\Defs\SoundDefs

Your sound files should be in: RimWorld\Mods\Save Our Ship\Sounds\Ship

These sounds must be in MONO, and OGG format, editable with a free program called Audacity: https://www.audacityteam.org/download/

<h4 class="headline-table-h4">1 )SoundDef <pre style="white-space:pre-line !important;">

<Defs> <SoundDef> ShipCombatYOUR_WEAPON_NAME</defName> ;; name this exactly as in the other XML in Weapon Code. false MapOnly <maxSimultaneous>1</maxSimultaneous> <priorityMode>PrioritizeNearest</priorityMode> <subSounds> <li> <muteWhenPaused>True</muteWhenPaused> <li Class="AudioGrain_Clip"> <clipPath>Ship/YOUR_WEAPON_NAME_01</clipPath> ;; the OGG file for your weapons effects. </li> <pitchRange>0.99~1.01</pitchRange> <volumeRange>525~525</volumeRange> <sustainAttack>2.5</sustainAttack> <sustainRelease>2.5</sustainRelease> </li> </subSounds> </SoundDef> </Defs>

<-- Research |