Trigger script on weapon-fire, Apply damage scripted

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2125
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Trigger script on weapon-fire, Apply damage scripted

Post by Ranakastrasz »

Is it feasible to have a script run whenever a weapon/turret/whatever fires? Or, better yet, on any data-based event?
Also, is it possible to run a data-event from script, or apply damage of a type (such that resistances and so on are all respected)

I have a flamethrower mod, which broke with one of the last 5 or so updates, since it worked for 12.10, but not now at 12.21.

Essentially, I had attached several line-damage effects, which used the railgun's targeting logic to damage everything in the area, and simulated a sort of cone via several layers. However, in the current game version, the railgun's logic is entirely nonfunctional, so the flamethrower is nonfunctional.

The flamethrower weapon itself is a modified shotgun, since the flamethrower type has pretty much zero customization support.
This is the code I've been using.
code
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Post Reply

Return to “Modding discussion”