Tracer Ammunition

by Leoncio

Bullets fly in real-time, emit light, collide with objects and have bullet tracers.

Content
1 year, 6 months ago
1.1
1.31K
Combat

g Compatibility issues

1 year, 7 months ago

The way you've implemented the bullets - particularly in ammo.lua, is incredibly likely to cause compatibility issues - particularly on the shotgun shells, as you change the number of items in the action, and most mods refer to this with a hard-coded constant (e.g. ammo_type.action[2].repeat_count).
At minimum, rampant arsenal, while it doesn't crash, has some substantial issues, and I've just finished fixing True-Nukes for it.

1 year, 7 months ago

I would love to know more about how I could try and fix it, this is my first mod and have very little knowledge of coding/modding (i.e. I don't know the nomenclature of coding to know what you are telling me ) so I wouldn't know what exactly would cause the incompatibility. Should I try and change it through the "data.raw" way instead?, like this " data.raw["gun"]["shotgun"].ammo_type.action[2].repeat_count = 12 " ?

1 year, 7 months ago

Yeah, that's generally good form (at least in my opinion) - it can result in you having to do more to deal with things yourself, but designating things from scratch can cause more problems - in particular it can cause crashes in other mods or can even revert their changes.
My big concern is that the replacement values you give have a different structure than the originals. The one I hit was that you reassign "piercing-shotgun-shell" In the original there are two elements in the 'action' table, in your changes there are only one. Because of this, any mod which indexes the second element will fail to load, so will need special code to cope.

1 year, 7 months ago

The first action in the original creates the "explosion-gunshot", and the second creates the projectile, whereas you create the "explosion-gunshot" as a source effect. There isn't any real difference, but it matters for compatibility.

1 year, 7 months ago

I always try and use the data.raw way - particularly if I'm changing something in vanilla, as otherwise it can get messy with other mods.
I also try and use table.deepcopy(data.raw.whatever) for creating my own version of things, so I can preserve other changes made by other mods, though this can get kinda vulnerable to other mods doing weird stuff, and is more personal taste I guess.

1 year, 7 months ago
(updated 1 year, 7 months ago)

The table.deepcopy thing would mean that for the high-caliber-pistol, you would do:

local highCaliberPistol = table.deepcopy(data.raw["gun"]["pistol"])
highCaliberPistol.name = "high-caliber-pistol"
highCaliberPistol.icon = "__new_weapons__/graphics/icons/high_caliber_pistol.png"
highCaliberPistol.order = "a[basic-clips]-b[pistol]"
highCaliberPistol.attack_parameters.damage_modifier = 2.3
highCaliberPistol.attack_parameters.cooldown = 18
highCaliberPistol.attack_parameters.movement_slow_down_factor = 0.05
highCaliberPistol.attack_parameters.range = 22
data:extend({highCaliberPistol})

1 year, 7 months ago

Feel free to ask me anything though, I'm happy to help.

1 year, 7 months ago

I will try that on the next version! However, the High Caliber Pistol is for my other mod, "New weapons". But I guess that these changes can be used for the Tracer ammunition mod as well?

1 year, 7 months ago

Yeah, I was just using it as an example.

1 year, 5 months ago

This seems to conflict completely with "Warheads" which is required for "TrueNukes". If I disable this mod I can enable Warheads, but I cannot have them enabled at the same time unfortunately because this looks like a really fun mod to play with. This is the startup error.

Failed to load mods: _ Warheads _ /prototypes/basegame-weapontype-add.lua:23:attempt to index field '?' (a nil value)
stack traceback: _ Warheads /prototypes/basegame-weapontype-add.lua:23: in main chunk
[C]: in function 'require' _ _Warheads
_/data.lua:2:in main chunk

1 year, 5 months ago

Generally the mods do work together, but they have issues (very quickly) when combined with other mods. What other mods are you using with them?

1 year, 5 months ago

AAI Containers & Warehouses
AAI Vehicles: Chaingunner - Ironclad - Miner
Adaptive Movement Speed
Alien Biomes+High Res Terrain
Ammo Loader+++
Armoured Biters
Auto Deconstruct
Blood & Gore Updated
Bob's Classes and Multiple characters mod
Bob's Functions Library mod
Clean Floor
Early Armor Grid
Even Distribution
EvoGUI
Explosive Excavation
Fluid Must Flow
Hardcore Start
Hovercrafts
Inbuilt Lighting
Informatron
Ironclad Gunboat and Mortar Turret
Kills to Science
Landmine Gridlock
Light Cone
Lightorio
Lily's Dark GUI
MD2R reskin: AAI Mining Vehicle
Mining Drones 2 Remastered
Mining patch planner
Night Brightness
Rampant
Reduce Damage Flash
Robot Army
RPG System
Scrapper's Delight
Shield Generators
Simple Air Cleaner
Soundpack: Epic Weapons Sounds
Swarmageddon - Enhanced Biter Swarms
Tank Flamethrower Rework
Tracer Ammunition
Vanilla Loaders
Vehicles Trails
Vehicle Snap
VortiK;s Armor Plating

Disabled:
True Nukes
True Nukes Graphics
Warheads

Quality of Life research
KS Combat_Updated
Hardcore Start
Factory Planner
Factorio Library
Bullet Trails

It's a lot I know, I'm constantly trying out different mods trying to find a mix I like

1 year, 5 months ago

Ah damn it, I figured it out. After testing Soundpack, Rampant and the Tank Flamethrower rework I looked back at the error and realized it was saying, "Warheads /prototypes/basegame-weapontype-add.lua:23" so I figured it must be a new weapon and the only one I could think of that was similar had to the "AAI Ironclad". I disabled it and now Tracer Ammunition and Warheads will load together. So those three can't be active at the same time which REALLY blows for me because I really wanted to use Ironclad.

1 year, 5 months ago

Ahhh, that figures.
I'll add some code to compensate in warheads, tho the issue is kinda Tracer Ammo being super aggressive about how it changes prototypes.
I'll do that next weekend though, as I'm busy rn.

1 year, 5 months ago

All good, thank you

1 year, 4 months ago

This mod breaks any shotgun turret mod, sadly.

New response