Something like event "on player near gate"

Place to get help with not working mods / modding interface.
Post Reply
Xmat
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Apr 14, 2016 3:55 pm
Contact:

Something like event "on player near gate"

Post by Xmat »

Hello,
I am playing multiplayer with friends and we all have different forces because of separated research. But we want to open gates automatically when any of us comes near to them.
So I am creating a mod for it (as I didn't find anything useful yet) and I am looking for something like "on player near gate" event, then I would call request_to_open on gate entity (with fake force). Is there any possibility to achieve that? And if, how?
Thanks a lot!

seronis
Fast Inserter
Fast Inserter
Posts: 225
Joined: Fri Mar 04, 2016 8:04 pm
Contact:

Re: Something like event "on player near gate"

Post by seronis »

I dont actually use gates and my modding experience is very limited to some tweaking at the moment, but couldnt you accomplish this by setting the ownership of the gate to a neutral party or would that allow biters to open it too ? Is there even a neutral force ?

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

Re: Something like event "on player near gate"

Post by Klonan »

Why not simply have each player put down their own gate?

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Something like event "on player near gate"

Post by daniel34 »

Klonan wrote:Why not simply have each player put down their own gate?
Also, if there are several gate segments with different forces next to each other and at least one segment belongs to the force of a player, the whole gate will open for that player.
quick links: log file | graphical issues | wiki

Xmat
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Apr 14, 2016 3:55 pm
Contact:

Re: Something like event "on player near gate"

Post by Xmat »

Thank you for your suggestions, but those are possible only when I am thinking about 3-4 people max. When more people come, better solution is required. And that is what I am looking for.

@seronis: there is neutral faction, but
a) I don't know if biters can open it.
b) I would have to do that for every single gate. My factory now containts like 150 gates... And I don't know if it is even possible.

seronis
Fast Inserter
Fast Inserter
Posts: 225
Joined: Fri Mar 04, 2016 8:04 pm
Contact:

Re: Something like event "on player near gate"

Post by seronis »

Xmat wrote: b) I would have to do that for every single gate. My factory now containts like 150 gates... And I don't know if it is even possible.
I actually meant that if a neutral gate works then just have a mod that makes all gates neutral instead of being owned. That is something that can be done in the on_built event so that it doesnt cause a CPU hit like a location based event would do.

Xmat
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Apr 14, 2016 3:55 pm
Contact:

Re: Something like event "on player near gate"

Post by Xmat »

Okay, I understand. Thanks for your idea, I am going to try it. :-)

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Something like event "on player near gate"

Post by daniel34 »

seronis wrote:
Xmat wrote: b) I would have to do that for every single gate. My factory now containts like 150 gates... And I don't know if it is even possible.
I actually meant that if a neutral gate works then just have a mod that makes all gates neutral instead of being owned. That is something that can be done in the on_built event so that it doesnt cause a CPU hit like a location based event would do.
I thought that too, that's when I tested it and came to the conclusion that
daniel34 wrote:if there are several gate segments with different forces next to each other and at least one segment belongs to the force of a player, the whole gate will open for that player
So no, neutral gates won't open for any other force.
quick links: log file | graphical issues | wiki

MrDoomah
Fast Inserter
Fast Inserter
Posts: 196
Joined: Mon Jun 01, 2015 1:11 pm
Contact:

Re: Something like event "on player near gate"

Post by MrDoomah »

You might also create a key item. When you place this item on a gate it opens for 5 seconds or so.

Post Reply

Return to “Modding help”