Beshinei's Respectful Missfired Bullet Tracers


A mix of bullet tracers and distant misfires, this is how I imagined bullet trails, respecting actual turret/weapon ranges, ammo bonuses and quality too! Based on Bullet Tracers (Ownly's) - 2.1 Fork

Tweaks
6 days ago
2.1
50
Combat
Owner:
Beshinei
Source:
https://github.com/GuzevArtem/beshine...
Homepage:
https://mods.factorio.com/mod/beshine...
License:
MIT
Created:
10 days ago
Latest Version:
1.0.7 (6 days ago)
Factorio version:
2.1
Downloaded by:
50 users

A mod that combines misfires with tracers without compromising the individual characteristics of the shooting entity.

Attempted to be as mod-compatible as possible, partially by reusing as many properties as possible from the entity itself, and partially by exposing configurations in the mod-data.

Based on https://mods.factorio.com/mod/ownlys_tracers_21_fork, but was heavily rewritten on the logic side.
The original behaviour can be enabled by choosing "Unified" mode of operation in the mode settings. However, some entities' properties will be lost in that mode, as well as quality effects.

Warning

Mod is in an early development stage, and 'API' is expected to change.

Modes of operations

Unified

Simplest and performance-wise cheapest. Replaces target_effects for each ammo type with "projectile" that has a custom prototype (overridable per ammo type) and misfire settings.
Range is fixed, damage is fixed (no turret or ammo quality bonuses apply).

Lua

Generates a unique projectile for each existing ammo type. Target effects from the ammo type is MOVED to the target_effects of the projectile. Replaces the cosmetic explosion effect with a custom one.

{
    type = "create-entity",
    name = "explosion-hit"
}

Sets ammo type target_effect as "script" with custom event id "beshineis_tracers_spawn_bullet_projectile_event".
On shot, the script calculates deviation values, selects target entity (if required), extracts full range (gun/turret range * quality range modifier * ammo range modifier), extracts ammo damage bonus (only quality default multiplier for now), deduces target position, picks projectile prototype for that ammo, and spawns a new projectile.

[Redacted]

[Redacted]
TBD

Other mods compatibility

Should be compatible with most existing mods, except mods that do the same thing. Should not crash, but may not work as expected.

Potential conflicts:

In all modes of operation:

  • Mods that change ammo_type.target_type, since it's a necessary setting for proper animations and targeting
  • Mods that REPLACE target_deliveries.target_effects; they may overwrite changes made by this one

In Mode of Operations=Unified

  • Mods that change ranges of turrets/guns beyond the Minimal bullet fly range value. Turret will shoot, but bullets will never reach its target.
  • Mods that add range modifiers for ammo. Will be ignored.

In Mode of Operations=Lua

  • Mods that applies base_damage_modifiers or bonus_damage_modifiers modifiers. Since both require a projectile, there is no clear way to merge projectile settings automatically. Current behaviour - both projectiles will spawn.
  • Mods that alter turret ranges in unexpected ways. If a mod replaces a turret with another entity, it is expected to work fine, since scripts don't care, as long as reference to source_entity stays valid.

In Mode of Operations=[Redacted]

...

Overrides

During the data stage data.lua mod exposes structs that can be overridden or extended by other mods.
This is done to allow opt-out or customise entity settings by other mods. Since some logic is stored in ammo prototypes - it is impossible to opt-out entirely, but it is possible to remove deviation.

See github for more info.

TODO

  • Replace thumbnail with a unique one
  • Redraw/extend library of tracers. (Currently missing blue-plutonium and purple-tungsten variations from common mods)
  • Handle character/characters' guns explicitly - give them suitable defaults, so the player won't shoot from their stomach.

Wishlist

  • Find a way to make player_targeting "runtime-per-player" setting, keeping turrets(vehicles?) as startup.
  • Support skins, in the way that projectile spawn position could/will be adjusted for skins with gun location that differs from vanilla
  • Create satelite mod(s), that exposes individual configurations. Only these satellite mods will handle modded entities explicitly, but those mods require a settings generator of some kind. (As in Better Planets). Mods needed for: tracer settings per ammo; projectile/shell/deviation settings per gun(including vehicle gun's)/turret/armor(or 'naked' engineer)
  • Add third mode of operation - codename [Redacted]. It will create more prototypes, but should be practically without events at runtime. (Only callbacks for events that require entity swapping)

Known issues

  • Misaligned projectiles - figuring out how to properly set up projectile creation properties. Default source position seems to be not exactly correct.
  • Misaligned 'miss' effects - if nothing was hit, the bullet will 'explode' 1-2 tiles farther, then at the actual hit position, giving the wrong expectation of range.
  • Missing documentation on overridable mod-data (only some comments in code)