Artillery targeting behavior?

Place to get help with not working mods / modding interface.
HURTZCO
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Sep 09, 2020 12:26 am
Contact:

Artillery targeting behavior?

Post by HURTZCO »

Anyone has any data, or knows where I can find in the game code how the artillery (or any turret, really) aims, specifically regarding the manual targeting? I have an idea for a mod but I'd need to understand that behavior to get it working properly.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Artillery targeting behavior?

Post by Qon »

Code: Select all

entity.surface.create_entity({
                    name = "artillery-flare",
                    position = {x, y},
                    force = entity.force,
            })
My mod ArtilleryCombinator creates artillery-flare's at the position you decide with your combinator. An artillery flare is the targeting dot that is placed with the manual targeting tool and which artillery will aim at.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
HURTZCO
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Sep 09, 2020 12:26 am
Contact:

Re: Artillery targeting behavior?

Post by HURTZCO »

So if I want any turret-specific behavior that doesn't apply to all artillery, I'll have to write the script to get the behavior going?

Because really that was part of my plan - cloning/instancing parts or the totality of the Artillery class to create a separate artillery call that wouldn't interfere with normal artillery turrets/wagons.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Artillery targeting behavior?

Post by eradicator »

HURTZCO wrote: Wed Sep 09, 2020 3:24 pm Because really that was part of my plan - cloning/instancing parts or the totality of the Artillery class to create a separate artillery call that wouldn't interfere with normal artillery turrets/wagons.
The factorio API does not offer that kind of low-level access to classes. Want different behavior from a base entity -> Have to use a fake entity and script it all yourself. Possibly including the spawning of projectiles.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
HURTZCO
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Sep 09, 2020 12:26 am
Contact:

Re: Artillery targeting behavior?

Post by HURTZCO »

But for a completely new entity that would simulate base-like behavior, I'll have to write the whole thing from scratch and everything should be good, correct?

In this case, is there a way to get a turret to only attack a specific type of entity?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Artillery targeting behavior?

Post by eradicator »

HURTZCO wrote: Wed Sep 09, 2020 3:54 pm But for a completely new entity that would simulate base-like behavior, I'll have to write the whole thing from scratch and everything should be good, correct?
Everything except possibly performance ;).
HURTZCO wrote: Wed Sep 09, 2020 3:54 pm In this case, is there a way to get a turret to only attack a specific type of entity?
TriggerTargetMask + TriggerTargetType as far as i understand
https://wiki.factorio.com/Types/TriggerTargetMask
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
HURTZCO
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Sep 09, 2020 12:26 am
Contact:

Re: Artillery targeting behavior?

Post by HURTZCO »

Sounds like it would be more beneficial to change the game up a bit around my content instead of trying to implement the behavior that would make my mod unique 😂
Post Reply

Return to “Modding help”