Modular Weapons Files - DotModGroup/ColdWaters-DotMod GitHub Wiki
Introduction
DotMod 0.2c brings an exciting new feature to DotMod, modular weapons files! These are intended to allow the breaking of weapons out of the main weapons.txt file into their own separate files. This should allow mods to only alter the files that they touch and not interfere with each other.
Premise
The internal function that parses text files is broken out into a special case for when weapons.txt is called upon. Instead of loading weapons.txt the script looks for files in the weapons folder. These are parsed to create modular weapons (and depthweapons and countermeasures). The code then goes looking for the weapons.txt file. This is parsed to find any weapons, depth weapons or countermeasures we were not already aware of. The whole lot is then smashed back together, cached to save it from being loaded many times, and then returned as if it was the original file.
Usage
Location
Weapon files should go in the dotmod/weapons
for files created by the DotMod team or the override/weapons
folder (or any child subfolder of that, this alllows for sorting)
File Names
Weapon files are named weapon_*.txt
DepthWeapon files are named depthweapon_*.txt
Countermeasure files are named countermeasure_*.txt
File Formats
Weapon File
WeaponType=TORPEDO
Warhead=300
SensorRange=2600
SensorAngles=45,5
WakeHomingSensorAngle=120
WakeHomeOnly=TRUE
WakeMaxDetectionDistance=350
WakeHomeTurnDelay=10
MinWakeBubbleLifeTimeDetectable=0
MaxLaunchDepth=354
WeaponRanges=14049,24059
WeaponSpeed=68,45
TurnRate=21.4
MaxPitchAngle=30
HomeSettings=PASSIVE
AttackSettings=STRAIGHT
DepthSettings=SHIP
WeaponNoiseValues=140,140
WeaponSprite=hud/sprites/wp_53-65_sprite.png
MinCameraDistance=0.3
ResupplyTime=30
[Model]
AssetBundle=bundles/dotmod/weapons/wp/wp_53-65_tex
ModelFile=weapons/assets/wp_set-65
Material=assets/resourcesforbundles/weapons/wp/wp_53-65_mat.mat
MaterialTextures=assets/resourcesforbundles/weapons/wp/wp_53-65_tx.dds
MeshPosition=0,0,0
MeshWeapon=SET-65
MeshWeaponPropRotation=700
MeshWeaponProp=SET-65_propl
MeshWeaponPropRotation=-700
MeshWeaponProp=SET-65_propr
MeshPosition=0,0,-0.06
CavitationParticle=weapons/assets/torpedo_cavitation_particle
AudioSource=TorpedoEngine
AudioClip=audio/engine/torpedo_in_water_loop.ogg
AudioRollOff=LOGARITHMIC
AudioDistance=1,25
AudioPitch=1
AudioLoop=TRUE
[/Model]
Depth Weapon File
DepthWeaponWarhead=10
DepthWeaponRange=100,24000
DepthWeaponNumberFired=26
DepthWeaponRateOfFire=1.2
DepthWeaponReloadTime=30
DepthWeaponVelocity=5.2
DepthWeaponAccuracy=1
Countermeasure File
CountermeasureObjectReference=wakebubble
CountermeasureType=WAKEBUBBLE
Lifetime=580
WakeBubbleDropInterval=20
DisplayIconsOnDebug=TRUE
SinkRate=0
NoiseStrength=0
CountermeasureDescription=FALSE
[Model]
[/Model]
weaponsscript_public.py
This program will come as a part of the BE version only. It takes a weapons.txt file and splits it by weapon and saves it to the given directory. Useful if you are maintaining an add-on and would like to split your weapons.txt file up to take advantage of this new feature. Ensure a relatively recent Python version is installed on your machine. Then, run the program and input the location of your weapons.txt file and the output directory. The program will quickly run through the file. Note that any comments not in between a WeaponObjectReference, DepthWeaponObjectReference, or CountermeasureName line and a [/model] line will not be saved to any file.