Page 1 of 1

API of the armed entities. Guided weapons

Posted: Sat Dec 29, 2018 1:52 pm
by regedit2000
TL; DR
Propose to extend the API of the armed entities guided weapons

what ?
Now weapons control is possible only for characters through "selected_gun_index", but multiple weapons are also used in transport but there is no access to it (as an option, you can use access through the driver ). An example of a mod where this can be used is AAI Programmable Vehicles. In addition to the selection of weapons, you can turn it on/ off, change the response radius and the current cell with ammunition (for turrets)

why ?
More features for modding and game control

Re: API of the armed entities. Guided weapons

Posted: Thu Jan 10, 2019 2:18 am
by Rseding91
I'm not sure exactly what you're asking for?

Re: API of the armed entities. Guided weapons

Posted: Fri Jan 11, 2019 9:55 pm
by regedit2000
I want through the API:
- manage weapons transport (choose from several active for the character).
- choose the ammo for the gun turrets.
- control the guns themselves (turn on/off, change the range and strength of the shot (for lasers)).

Application:
- scenarios
- mods mentioned above.

Why: single / universal management of similar entity capabilities.

Additionally:
- Passengers-number, control (roles: driver/shooter/cargo), access to weapons transport, the ability to use their own guns from the inside

Re: API of the armed entities. Guided weapons

Posted: Fri Jan 11, 2019 10:34 pm
by Rseding91
regedit2000 wrote:- manage weapons transport (choose from several active for the character).
I still don't understand. There is no such thing as "weapons transport" in Factorio. Maybe there's a translation issue here.
regedit2000 wrote:- choose the ammo for the gun turrets.
You can already do that by just putting different ammo in the gun turrets.
regedit2000 wrote:- control the guns themselves (turn on/off, change the range and strength of the shot (for lasers)).
You can already do that by setting entity.active = true/false and adjusting the technology modifiers for the given lasers.

Turret/gun range can't be adjusted runtime and never will be. There's a massive amount of game logic which assumes it never changes and is built on it never changing once the game is loaded.

Re: API of the armed entities. Guided weapons

Posted: Sat Jan 12, 2019 12:30 am
by regedit2000
============================================================================
Rseding91 wrote:
Fri Jan 11, 2019 10:34 pm
I still don't understand. There is no such thing as "weapons transport" in Factorio. Maybe there's a translation issue here.
vehichle
weapon.png
weapon.png (521.54 KiB) Viewed 2908 times
============================================================================
Rseding91 wrote:
Fri Jan 11, 2019 10:34 pm
You can already do that by just putting different ammo in the gun turrets.
clip.png
clip.png (114.26 KiB) Viewed 2908 times
============================================================================
Rseding91 wrote:
Fri Jan 11, 2019 10:34 pm
You can already do that by setting entity.active = true/false and adjusting the technology modifiers for the given lasers.

Turret/gun range can't be adjusted runtime and never will be. There's a massive amount of game logic which assumes it never changes and is built on it never changing once the game is loaded.
OK. I understood

Re: API of the armed entities. Guided weapons

Posted: Thu May 02, 2019 12:45 am
by regedit2000
I'll try to be more precise.
The LuaEntity class provides the variable selected_gun_index for the type "Character" - I suggest the variable selected_gun_index to use for the type "Vehicle".
I also suggest using the new variable selected_ammo_index for the type "Turret"

Re: API of the armed entities. Guided weapons

Posted: Thu Jun 06, 2019 12:06 pm
by Boodals
I have implemented selected_gun_index for entities of type Car (which includes tanks) (I have source access). It will be in 0.17.46.
If you want selected_ammo_index for turrets, I suggest making a new topic. I didn't look at implementing it because I don't know how turrets behave when they have multiple ammo slots. It might not be possible, it might be easy.

Re: API of the armed entities. Guided weapons

Posted: Mon Jun 10, 2019 3:21 pm
by regedit2000
Boodals wrote:
Thu Jun 06, 2019 12:06 pm
I have implemented selected_gun_index for entities of type Car (which includes tanks) (I have source access). It will be in 0.17.46.
If you want selected_ammo_index for turrets, I suggest making a new topic. I didn't look at implementing it because I don't know how turrets behave when they have multiple ammo slots. It might not be possible, it might be easy.
Thank you very much