Rimfire (mod)

From RimWorld Wiki
Revision as of 22:23, 15 February 2023 by Harakoni (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Rimfire

RELEASED


Author
Alistaire
Version
v1.9
First Release
2015-01-22
Compatibility
0.18.1722

Rimfire is a weapons mod with custom textures and sounds. Its goal is to create quality content which mimics the base game's art style and weapon balance as much as possible.

It is compatible with versions Alpha 8+.

Feature list[edit]

Weapons[edit]

Here's a list of the weapons currently in the mod:

Mod version Label Based on
init burstfire machinepistol Beretta 93R
init automatic shotgun AA-12/Auto-Assault Shotgun
init pocket revolver Derringer
init jagged rifle IMI Galil
init greasegun SMG M3 submachine gun
init mitrailleuse M134 minigun
init 3-line rifle Mosin-Nagant
init hunting rifle Steyr Scout
init folding stock SMG Škorpion vz. 61
init combat shotgun Cobray Streetsweeper
init silenced PDW Steyr TMP
init machinepistol Intratec TEC-9
init modern SMG KRISS Vector
init specialist rifle Walther WA 2000
init military rifle H&K XM-8
1.2 multiple grenade launcher Milkor MGL
1.3 detective pistol Sphinx AT 2000
1.3 soviet pistol Tokarev TT-30
1.4 deadeye rifle Armalite AR-50
1.4 heavy AMR MICOR Leader 50
1.4 counterfeit handgun Para Ordnance P14-45
1.4 SASR PGM 'Hécate II'
1.5 storm carbine Beretta Cx-4 Storm
1.5 police carbine Ruger PC9
1.5 civilian PCC H&K USC
1.8 CAW shotgun H&K CAWS
1.9 court revolver Taurus Judge
1.9 aluminum-cast SMG Hafdasa C-4
1.9 guerrilla rifle AK-47
1.9 box-magazine GPMG Type 73
1.9 replica LMG Madsen LMG
1.9 RPG launcher RPG-7 Commando
2.1 large-calibre revolver S&W Model 500
2.1 rimfire pistol Ruger Mk III Standard
2.1 aviation crew SMG H&K MP5K-PDW
2.1 varmint rifle Ruger 10/22
2.1 repeating rifle Spencer Repeating Rifle
2.1 soviet DMR Dragunov SVD
2.1 police AMR Barrett M82A1
2.1 replica GPMG Rheinmetall MG60
2.1 MAAWS Carl Gustaf recoilless rifle
2.1 short crossbow
2.1 charge pistol
2.1 charge SMG
2.1 charge shotgun
2.1 charge sniper rifle
2.1 atlatl Atlatl


Research projects[edit]

Rimfire added weapon crafting research since Alpha 13 since the base game included this.

Mod version Project Requirements Unlocks crafting of..
v1.9 small rockets machining RPG launcher
v1.9 antimateriel weapons plasteel guns deadeye rifle, heavy AMR, SASR
v1.9 plasteel guns machining detective pistol, modern SMG, automatic shotgun, military rifle, deadeye rifle, multiple grenade launcher
v1.9 multibarrel weapons microelectronics basics mitrailleuse
v2.4 antimateriel weapons plasteel guns -
v2.4 plasteel guns precision rifling detective pistol, modern SMG, automatic shotgun, military rifle, hunting rifle, multiple grenade launcher
v2.4 small rockets gas operation RPG launcher, MAAWS


Mod versions[edit]

Game version Mod version Release Weapons # Description Requirements Update post Download ModDB Nexus
Alpha 8 1.0 15 Rimfire v1.0 first release, added fifteen weapons. Dropbox
Alpha 8 1.0 CR 15 Rimfire v1.0 rebalanced to work with CombatRealism. CR Thread Dropbox
Alpha 9 1.1 15 Rimfire v1.1's artstyle was adjusted to Alpha 9's. Thread Dropbox
Alpha 9 1.1 CR 15 Rimfire v1.1 rebalanced to work with CombatRealism. CR Thread Dropbox
Alpha 9 1.2 16 Rimfire v1.2 added one grenade launcher. Thread Dropbox
Alpha 9 1.2 CR 16 Rimfire v1.2 rebalanced to work with CombatRealism. CR Dropbox
Alpha 9 1.2 3DP 0 A Rimfire v1.2 (CR) patch for Enhanced 3D Printed Guns and Armor. E3DPGA
Rimfire v1.2 (CR)
Forums
Alpha 10 1.3 19 Rimfire v1.3's artstyle was adjusted to Alpha 10's, three pistols were added. Thread Dropbox
Alpha 10 1.3 CR 19 Rimfire v1.3 rebalanced to work with CombatRealism. CR Thread Dropbox
Alpha 10 1.3 BSC 0 A Rimfire v1.3 (CR) patch for Brunayla's Security Co. BSC
Rimfire v1.3 (CR)
Forums
Alpha 11 1.4 23 Rimfire v1.4 added three sniper rifles and a pistol. Thread Dropbox
Alpha 11 1.5 26 Rimfire v1.5 added three carbines. Thread Dropbox
Alpha 11b 1.6 26 Rimfire v1.6 rebalanced carbines and compiled DLL for Alpha 11b. Thread Dropbox
Alpha 12 1.7 26 Rimfire v1.7 compiled DLL for Alpha 12. Thread Dropbox
Alpha 12 1.8 27 Rimfire v1.8 added a shotgun and redid all sounds. Thread Dropbox
Alpha 12 1.8 CR 27 Rimfire v1.8 rebalanced to work with CombatRealism. CR
CCL
Thread Dropbox
Alpha 12 1.8 CR_SK 27 Hardcore SK modified version of Rimfire v1.8 for CombatRealism. SK Forums
Alpha 12 1.8 TGP 27 TheGentlePack modified version of Rimfire. TGP Forums
Alpha 13 1.9 33 Rimfire v1.9 added six guns and reworked all graphics, added recipes and research. Thread Dropbox
Alpha 13 2.0 33 Rimfire v2.0 had a Community Core Library v13 requirement and added RPG-7 smoke trails. Thread Dropbox
Alpha 14 2.1 48 Rimfire v2.1 added fifteen guns, redid a few sounds and improved on the Mod Configuration Menu. Thread Dropbox
Alpha 14 2.1 CR 48 Rimfire v2.1 stripped and balanced to work with CombatRealism 1.6.7.3. CR 1.6.7.3 Thread Dropbox
Alpha 14 2.1 Hands 0 A Rimfire v2.1 (CR) patch for Clutter Misc v1.0.3's "Clutter Misc Module - Hands". Clutter Misc v1.0.3 Thread Dropbox
Alpha 16 2.2 48 Rimfire v2.2 moved the GunMod menu over to HugsLib. Thread Dropbox
Alpha 16 2.2 CR 48 Rimfire v2.2 balanced to work with CombatRealism 1.6.9.2. CR 1.6.9.2+ Thread Dropbox
Alpha 17 2.3 48 Rimfire v2.3 saw a graphical update to the HugsLib mod menu and some anti-materiel rifle nerfs. Thread Dropbox
Beta 18 2.4 48 Rimfire v2.4 made large changes to gun balance to fit vanilla DPS curves. Thread Dropbox
Release 1.0 2.5 48 Rimfire v2.5 rebalanced all guns to 1.0 mechanics and DPS curves, again. Thread Dropbox
Release 1.1/1.2 2.6 48 Rimfire v2.6 brings Rimfire to RimWorld 1.1+. Thread Dropbox

Mod source[edit]

Game version Mod version Release Description Download
Alpha 13 2.0 C# Source for "Rimfire/Assemblies/AntiMateriel.dll", "Rimfire/Assemblies/SmokeTrails.dll", "Rimfire/Assemblies/GunModMCM.dll" Dropbox
Alpha 16 2.1 C# Source for several assemblies (including WIP ones for designated marksman rifles). Dropbox
Alpha 18 2.4 C# Source for three relevant assemblies. Dropbox

Polls[edit]

Question Option Votes Percentage
What weapons do you want me to focus on? (Post comments) Common weapons: Benelli M3, AK-47, M4A1 (weaponry you probably know) 115 55.6%
Uncommon weapons: South-African, Indian, South-American (weaponry you probably haven't heard of before) 92 44.4%
Total 207 100.0%

Def Compatibility[edit]

Every ThingDef <defName> used in the mod has "RF_" as prefix (e.g "RF_Gun_Deringer") to prevent incompatibility issues with other mods. This should make it possible to run it with any Alpha 9+ mod without guns overriding each other.

GunModMCM Compatibility[edit]

Rimfire v2.0/2.1 add a Community Core Library (CCL) Mod Configuration Menu (MCM): the Gun Mod Config Menu while v2.2 adds a HugsLib Mod Setting Menu. This contains several options:

Inactive weapon removal[edit]

  • Enabled: all disabled guns below are actively destroyed (untradable, destroy on drop, not saved),
  • Disabled: disabled guns are prevented from being created anymore.

Added in v2.0, this option causes all weapons in the weapon selection list which are disabled (red cross) to have the following changed about them:

Inactive weapon removal state XML tag Weapon state
Enabled Disabled
Disabled canBeSpawningInventory xml false
destroyOnDrop xml xml
isSaveable xml xml
menuHidden xml xml
equipmentType xml xml
tradeability xml Min(Sellable, xml)
smeltProducts xml xml
Enabled canBeSpawningInventory xml false
destroyOnDrop xml true
isSaveable xml false
menuHidden xml true
equipmentType xml None
tradeability xml Never
smeltProducts xml .Clear()
  • xml: The value from the XML file where this ThingDef is defined.

Weapon crafting[edit]

  • Enabled: all enabled guns below are craftable,
  • Disabled: none of the guns below are craftable.

Added in v2.0, this option causes all weapons in the weapon list to be non-craftable. This is to aid those people who do not enjoy weapon crafting to instantly remove the feature from all gun mods, temporarily.

Categorization[edit]

  • Enabled: vanilla and modded guns will be visibly categorized by type (pistol, shotgun).

Added in v2.0, this option causes all weapons in the weapon list to be categorized into more descriptive categories, specifically the ones below (and possibly more, depending on the degree of compatibility implemented by other gun mods):

  • GunModMCM_WeaponsMelee
    • NeolithicMelee
    • MedievalMelee
    • IndustrialMelee
    • SpacerMelee
  • GunModMCM_WeaponsRanged
    • GunModMCM_Grenades
    • NeolithicRanged
    • MedievalRanged
    • IndustrialRanged
      • Pistols
      • Revolvers
      • Shotguns
      • Carbines
      • Rifles
      • SniperRifles
      • AntiMateriel
      • SubMachineGuns
      • MachineGuns
      • HeavyWeapons
    • SpacerRanged
      • ChargeGuns
      • MechanoidGuns

GunModMCM looks for ThingCategoryDefs with names GunModMCM_basegame category which are used for categorization.

Simple ThingDef compatibility/requirement[edit]
<?xml version="1.0" encoding="utf-8"?>
<ThingDefs>

	<!-- WeaponsRanged is usually already defined -->
	<ThingDef Name="GunBase">
		<thingCategories>
			<li>WeaponsRanged</li>
		</thingCategories>
	</ThingDef>

	<!-- This ThingDef has a Rimfire GunModMCM  !!  REQUIREMENT  !! -->
	<ThingDef ParentName="GunBase">
		<defName>Gun_Pistol_Requiring_Rimfire</defName>
		<thingCategories>
			<!-- Added by Rimfire (GunModMCM_WeaponsRanged > IndustrialRanged > Pistols) -->
			<li>Pistols</li>
		</thingCategories>
	</ThingDef>

	<!-- This ThingDef is Rimfire  !!  COMPATIBLE  !! -->
	<ThingDef ParentName="GunBase">
		<defName>Gun_Rifle_With_Rimfire_Compatibility</defName>
		<weaponTags>
			<!-- Format: GunModMCM_[any ThingCategoryDef defName] -->
			<li>GunModMCM_Pistols</li>
		</weaponTags>
	</ThingDef>
	
</ThingDefs>


In above example, switching on Categorization causes ThingDef Gun_Pistol_Requiring_Rimfire to be removed from ThingCategoryDef WeaponsRanged childThingDefs and it also causes ThingCategoryDef IndustrialRanged to be added to ThingCategoryDef WeaponsRanged childCategories. Switching Categorization off causes the opposite to happen.
To understand this concept I suggest trying it for yourself in the ModConfigurationMenu.

Example usage: <weaponTags><li>GunModMCM_ChargeGuns</li></weaponTags> can be added to a custom Charge weapon to categorize it correctly if Categorization is turned on.

As can be seen, a mod author can choose between adding a GunModMCM requirement or adding GunModMCM compatibility - it is suggested to use compatibility because weaponTags will not interfere with game functioning if Rimfire is not active.

Adding new WeaponsMelee/WeaponsRanged subcategories[edit]

To add new categories, create each ThingCategoryDef up to the category you want added (their full defs are present in Rimfire Defs/ThingCategoryDefs/ and can just be copied).

<?xml version="1.0" encoding="utf-8"?>
<Defs>

	<!-- Adding these ThingCategoryDefs present in Rimfire makes "AztecMelee" Rimfire GunModMCM  !!  COMPATIBLE  !! -->
	<ThingCategoryDef>
		<defName>GunModMCM_WeaponsMelee</defName>
		<label>melee weapons</label>
	</ThingCategoryDef>
	
		<!-- idem. -->
		<ThingCategoryDef>
			<defName>NeolithicMelee</defName>
			<label>neolithic weaponry</label>
			<parent>GunModMCM_WeaponsMelee</parent>
		</ThingCategoryDef>
	
			<!-- Without the two ThingCategoryDefs above, this would have a Rimfire GunModMCM  !!  REQUIREMENT  !! -->
			<ThingCategoryDef>
				<defName>AztecMelee</defName>
				<label>aztec</label>
				<parent>NeolithicMelee</parent>
			</ThingCategoryDef>
	
</Defs>


As can be seen, a mod author can choose between adding a GunModMCM requirement or adding GunModMCM compatibility - it is suggested to use compatibility because the ThingCategoryDefs GunModMCM_basegame category and its children will not show up anywhere in the game without GunModMCM active. Adding ThingDefs to this new category can be done using the ThingDef requirement or compatibility method again.

Adding new categorizable ThingCategoryDefs[edit]
<?xml version="1.0" encoding="utf-8"?>
<Defs>

	<!-- This category will show up as child of Weapons regardless of anything -->
	<ThingCategoryDef>
		<defName>WeaponsChemical</defName>
		<label>chemical weapons</label>
		<parent>Weapons</parent>
	</ThingCategoryDef>

	<!-- This category is hidden UNLESS Rimfire with GunModMCM is active and Categorization is turned on -->
	<ThingCategoryDef>
		<defName>GunModMCM_WeaponsChemical</defName>
		<label>chemical weapons</label>
	</ThingCategoryDef>

		<ThingCategoryDef>
			<defName>NerveAgents</defName>
			<label>nerve agents</label>
			<parent>GunModMCM_WeaponsChemical</parent>
		</ThingCategoryDef>

		<ThingCategoryDef>
			<defName>BlisterAgents</defName>
			<label>blister agents</label>
			<parent>GunModMCM_WeaponsChemical</parent>
		</ThingCategoryDef>
	
</Defs>


  • In above example, any ThingDef's thingCategories must contain both "WeaponsChemical" (to show up in vanilla) and their respective ThingCategoryDef chemical weaponry type (in case GunModMCM categorization is active).

This example shows the true flexibility of GunModMCM's Categorization option - any newly added subcategories of Weapons can now be categorized even further without the need to do so only partially: if the end user really enjoys categorization they will have this feature enabled already, and if the end user really dislikes categorization they won't have to deal with it at all.

Example compatibility[edit]
  • On your modded Industrial techLevel shotgun, add in ThingDef.weaponTags "GunModMCM_Shotguns" to add the shotgun to be categorized into the subcategory "Shotguns",
  • You have a modded Spacer techLevel laser rifle - copy ThingCategoryDefs GunModMCM_WeaponsRanged, SpacerRanged, add ThingCategoryDef LaserGuns with parent SpacerRanged. To the laser rifle ThingDef.thingCategories add LaserGuns and WeaponsRanged.

Name package[edit]

  • Select your preferred gun name package - gun names are automatically updated and displayed below.

Added in Rimfire 2.0, the mod contains name databases in \Languages\English\Keyed, with names in the form <*prefix**defName*>. Any time the Name packages are changed, all ThingDefs which have a translation option available in such form will get a new label. All cached labels are reset so Things will display the new ThingDef names.

In Rimfire v2.0+, the following *prefix*es exist (and are hardcoded in v2.2):

  • Short_
  • Long_
  • AEight_
  • ANine_
  • Simple_

Both Gun ThingDef and Weapon ThingDef names are present in these databases. This is necessary, compound names can not be generated because some name packages require a special name rather than *weapon name* bullet (e.g RPG launcher with rocket propelled grenade).

An example of a complete name database for the RF_Gun_USC and RF_Bullet_USC is the following:

<?xml version="1.0" encoding="utf-8"?>
<LanguageData>

	<Short_RF_Gun_USC>H&amp;K USC</Short_RF_Gun_USC>
	<Short_RF_Bullet_USC>H&amp;K USC bullet</Short_RF_Bullet_USC>

	<Long_RF_Gun_USC>Heckler &amp; Koch HK USC</Long_RF_Gun_USC>
	<Long_RF_Bullet_USC>Heckler &amp; Koch HK USC bullet</Long_RF_Bullet_USC>

	<AEight_RF_Gun_USC>USC carbine</AEight_RF_Gun_USC>
	<AEight_RF_Bullet_USC>USC carbine bullet</AEight_RF_Bullet_USC>

	<ANine_RF_Gun_USC>civilian PCC</ANine_RF_Gun_USC>
	<ANine_RF_Bullet_USC>civilian PCC bullet</ANine_RF_Bullet_USC>

	<Simple_RF_Gun_USC>multishot carbine</Simple_RF_Gun_USC>
	<Simple_RF_Bullet_USC>multishot carbine bullet</Simple_RF_Bullet_USC>

</LanguageData>


Unlocked weapon disabling[edit]

  • Enabled: the filter below will extend toggles for vanilla guns and all mod guns.

Added in Rimfire v2.1 (and always on in v2.2), this allows ALL weapons added by ALL mods to be toggled with some exceptions - the full IEnumerable<ThingDef> is created as follows:

//GunModMCM.ModConfigurationMenu_GunMod
public override void Initialize()
{
	//..

	var enumerable = DefDatabase<ThingDef>.AllDefs.Where(
			x => x.equipmentType == EquipmentType.Primary
			&& x.stuffProps == null		//wood log
			&& x.ingestible == null		//beer
		);
	var pawnDroppedBodyParts = DefDatabase<PawnKindDef>.AllDefs
		.Where(x => !x.lifeStages.NullOrEmpty())
		.SelectMany<PawnKindDef, ThingDef>(x => {
							var list = new HashSet<ThingDef>();
							foreach (PawnKindLifeStage stage
								in x.lifeStages.Where(y => y.dropBodyPart != null
											&& y.dropBodyPart.thing != null))
							{
								list.Add(stage.dropBodyPart.thing);
							}
							return list.Count > 0
								? list
								: Enumerable.Empty<ThingDef>();
						   });
	var turretGunTops = DefDatabase<ThingDef>.AllDefs
		.Where(x => x.building != null
		       && x.building.turretGunDef != null)
		.Select<ThingDef, ThingDef>(x => x.building.turretGunDef);
	FuzzyGunList.Initialize(enumerable
	                        .Except(pawnDroppedBodyParts)
	                        .Except(turretGunTops));
	
	//..
}


This query excludes:

  • <equipmentType> is not Primary
  • <stuffProps> is not null (wood logs)
  • <ingestible> is not null (beer)
  • ThingDefs which are dropBodyPart for any PawnKindDef (elephant tusks)
  • ThingDefs which are turretGunDef for any ThingDef building (turret guns)

Please ensure your weapons fit none of these excluded criteria.

Nuke disallowed[edit]

  • Clears the currently loaded colony save file of any of the currently disallowed guns. This change CAN NOT BE REVERTED.

Added in v2.1 (and is only available in-game), this removes every disabled weapon from Find.ListerThings (everything on the ground) and PawnUtility.AllPawnsMapOrWorldAliveOrDead (every carried weapon).

The use case for this feature is when you decide to disable a certain weapon mid-game and want to ensure it's instantly removed from the game, not just blocked from being spawned in.

Contact[edit]

If any of this is not clear enough, consider sending me a PM on the forums: Alistaire.