Handcannon

by snouz

A portable version of the tank cannon weapon. Based on Portable Tank Cannon by Kryzeth

Content
a month ago
2.0
1.98K
Combat

i How about pushback?

8 months ago

How about firing this pushes back the player in the opposite direction? That would make it "feel" more like a cannon shell firing compared to say rockets and other weapons. Would also give more of a reason for it to not be a "safe" or "stable" handheld weapon, and something more suited for a tank or turret. Maybe also the handheld variant to be moderately inaccurate, so you use it in a pinch but can't rely on it?

Would also give the railgun a reason to be a good upgrade late game, other than the piercing and damage uplifts of course.

What say?

8 months ago

That's a good idea! now I need to figure out how to do that effectively and optimized

8 months ago

The base game tesla turret already does that to biters, maybe there's a way to call that same method? Sorry I'd wish to help more but don't know the Factorio mod API well so just spitballing

4 months ago

The base game tesla turret already does that to biters, maybe there's a way to call that same method? Sorry I'd wish to help more but don't know the Factorio mod API well so just spitballing

Out of curiosity, I went looking for it. The item you're talking about is active-defense-equipment. All the effects from that sit inside an "action" AreaTriggerItem, which in turn has a single "action_delivery" InstantTriggerDelivery, which in turn has "target_effects" list consisting of two effects - CreateStickerTriggerEffectItem and PushBackTriggerEffectItem. The first one is responsible for the stun, but it's that second one that's responsible for the pushback.

All of that is to say that it should be possible to reuse this in the Handcannon. I don't have the time to test this, but in theory... The weapon's action_delivery would have to define a "source_effects" array, containing type = "push-back" and distance = 'some integer'. The problem is that this is kind of double-dipping. active-defense-equipment is its own bespoke ActiveDefenseEquipmentPrototype, meaning its interaction with ammo is undefined.

When looking at energy-using turrets, their attack_parameters are defined inside the turret prototype array. When looking at ammo-using turrets, their attack_parameters are defined within the ammo, with the turret prototype array only handling visualisation. Technically, it should be possible to define a delivery_action for both weapon and ammo, but I'm not sure how the game will handle that. Specifically, whether the game with apply both, just one or what. Probably worth experimenting with this as I'm trying to create incendiary rockets of my own, but definitely not trivial.

Well, not trivial to understand. Probably pretty trivial to do - provided it can work without requiring its own clone of tank shell ammo.

New response