Page 1 of 1

Point attack artillery

Posted: Sat Oct 01, 2016 11:06 am
by sore68
Hi everyone~

I making mod Additional-turret and It was recently added to the 2 type artillery.
viewtopic.php?f=93&t=30865

I make near spawner scan code and I think I'll use it when appropriate.

Code: Select all

/c local p = game.player.surface.find_entities_filtered({area = {{x = game.player.position.x - 100, y = game.player.position.y - 100}, {x = game.player.position.x + 100, y = game.player.position.y + 100}}, type = "unit-spawner"}) game.player.print(p.position.x.." "..p.position.y)
but I don't know how the turret attack that position.

Can you help me?? or tell me a website that can help me??


and have a question
http://lua-api.factorio.com/latest/defi ... d.compound
how to use defines codes??

Sorry my English skill... thank you!

Re: Point attack artillery

Posted: Sat Oct 01, 2016 12:07 pm
by aubergine18
Using find_entities_filtered() is quite slow if it's done over large area and regularly, which I think will happen in your mod.

It might be better to use events instead, have a look at the Fire Extinguisher mod to see how that works - I think you'll be able to adapt that code to what you want: https://mods.factorio.com/mods/devilwar ... tinguisher

Re: Point attack artillery

Posted: Sat Oct 01, 2016 2:27 pm
by Adil
You can't make turret just attack. You either make it ridiculously long-range, then it will aggro biters by shooting at them, or you use scripts to create projectiles and\or simulate the impact, then biters will just ignore the fact of being shot.

Re: Point attack artillery

Posted: Thu Oct 06, 2016 5:47 am
by sore68
Have a some different question

I finally did it. make projectiles with surface.create_entity!
But This code is not support "type = stream" projectiles (it is used fluid-turret ammo entity and I using this entity in artillery shell)
And If I use stream projectile, It is recognized in "type = beam".. :|

What other way do not use surface.create_entity??

Re: Point attack artillery

Posted: Thu Oct 06, 2016 11:46 am
by aubergine18
I've not tested, but maybe a stream will work similar to a beam? viewtopic.php?p=205338#p205338