need help with fly unit

Place to get help with not working mods / modding interface.
Post Reply
noir4
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jan 20, 2015 4:26 pm
Contact:

need help with fly unit

Post by noir4 »

Hello.

need help in creating a flying unit, in fact - the flying tank.
I will be grateful if someone would write a part of code or tell what flags should be used for this.

PS: want create Battle Cruiser from Starcraft :)
sorry for my english

FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: need help with fly unit

Post by FishSandwich »

I'm pretty sure you could do this just by following the Modding Tutorial, then changing individual bits of code to suit your needs.

noir4
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jan 20, 2015 4:26 pm
Contact:

Re: need help with fly unit

Post by noir4 »

saw this tutorial but did not understand which parameter is responsible for flight :(

can you tell? not very good with English :)
sorry for my english

FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: need help with fly unit

Post by FishSandwich »

There's no parameter to control flight, you simulate it by not putting a collision box.

User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: need help with fly unit

Post by L0771 »

I understand this, i'm working in a "blood-steam", and i can't make this "unit" fly, i have a problem with collision with entities.

I need this unit without collisions, like a fly unit (the command of blood-steam isn't configured yet, but is the same)
basically is a unit without collision_box and without collision_mask.

Image

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: need help with fly unit

Post by FreeER »

L0771 wrote:basically is a unit without collision_box and without collision_mask.
I noticed when I started updating the wiki tutorial to v11 that simply leaving out the collision_box didn't work (it still collided). Adding an empty collision mask property via

Code: Select all

collision_mask = {}
worked (without the collision_box, I expect it would work even with a collision_box specified though). I haven't gotten around to figuring out exactly how the new car animation works though so that's really the major delay on the tutorial update.
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: need help with fly unit

Post by L0771 »

FreeER wrote:I noticed when I started updating the wiki tutorial to v11 that simply leaving out the collision_box didn't work (it still collided). Adding an empty collision mask property via

Code: Select all

collision_mask = {}
worked (without the collision_box, I expect it would work even with a collision_box specified though). I haven't gotten around to figuring out exactly how the new car animation works though so that's really the major delay on the tutorial update.
Ok, i tried with

Code: Select all

collision_mask = { "not-colliding-with-itself", "water-tile" }
this don't work (i think this should work), and work fine with

Code: Select all

collision_mask = { "not-colliding-with-itself" }
I think the flying tank is similar.

Thank you and welcome back FreeER :)

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: need help with fly unit

Post by Adil »

I've done a bit of testing around.
What kovarex wrote on the wiki:
collision_mask
type: Types/CollisionMask

Default: Depends on Entity type

Two entities can collide only if they share a layer from the collision mask.
should be taken literally. The presence of "water-tile" doesn't mean entity will collide with water, it means it will collide with any other entity having that layer.
Having either "water-tile" in car mask makes it bump into transport belts. I presume that umodded car can't get in the water and collides with buildings because of "player-layer", while belt indeed has the "water-tile".
"not-colliding-with-itself" disables collisions with entities of the same type i.e. car will pass through tank.
"not-colliding-with-itself"-only or empty collision mask will allow you to drive out of the map borders into the empty blackness of cosmos. :D
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

noir4
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jan 20, 2015 4:26 pm
Contact:

Re: need help with fly unit

Post by noir4 »

FreeER wrote:
L0771 wrote:basically is a unit without collision_box and without collision_mask.
I noticed when I started updating the wiki tutorial to v11 that simply leaving out the collision_box didn't work (it still collided). Adding an empty collision mask property via

Code: Select all

collision_mask = {}
worked (without the collision_box, I expect it would work even with a collision_box specified though). I haven't gotten around to figuring out exactly how the new car animation works though so that's really the major delay on the tutorial update.
Thank you very much, it's helped. whether it is possible to make what unit moved above the trees and, like robots, could be attacked only range-attack.
sorry for my english

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: need help with fly unit

Post by Adil »

Flying robots can be attacked by melee units.
But they probably do have the collision mask and fly around because their collision box is zero.
See if your flying tank gets attacked at all.
edit: oh it will.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: need help with fly unit

Post by Adil »

Adil wrote:Flying robots can be attacked by melee units.
But they probably do have the collision mask and fly around because their collision box is zero.
See if your flying tank gets attacked at all.
edit: oh it will.
And zero sized tank still collides with trees which collision box covers the center of tank.
edit: oh damn, that was meant to be edit. :?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

User avatar
Stx3
Fast Inserter
Fast Inserter
Posts: 201
Joined: Wed Nov 05, 2014 9:04 am
Contact:

Re: need help with fly unit

Post by Stx3 »

omfg this is great!
Image
Image

Zuzak
Inserter
Inserter
Posts: 31
Joined: Sat Oct 04, 2014 6:09 pm
Contact:

Re: need help with fly unit

Post by Zuzak »

I didn't see this, seems I was not first one to make flying unit help post. mayhaps a mod can merge the 2 threads.
anyways take a look at the comments in the entity file for zoomer they will save you trial and error time

as for proper flying without collision:
collision_box = {{0, 0}, {0, 0}}, -- still leaves a 1 pixel collisional zone
collision_mask = {}, -- never collide, needs this to be able to 'drive' without hitting anything

until render layer is read by all types, it will still look like it goes behind trees and buildings

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: need help with fly unit

Post by Klonan »

Would just like to say, it would be so useful to have render_layer working for all entities.

User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: need help with fly unit

Post by L0771 »

Zuzak wrote:until render layer is read by all types, it will still look like it goes behind trees and buildings
i'm using this for my flying units.

Code: Select all

collision_box = nil
collision_mask = { "not-colliding-with-itself" } 
but can use

Code: Select all

collision_box = nil
collision_mask = {} 
Or other collision_mask
Collision_mask works with collision_box = nil

I hope this be helpful.

NOTE: I don't know why, transport belts aren't in object-layer, i can't do a unit fly over it :x

Post Reply

Return to “Modding help”