Getting player index in events like ontick?

Place to get help with not working mods / modding interface.
Post Reply
iUltimateLP
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Sun May 24, 2015 4:41 pm
Contact:

Getting player index in events like ontick?

Post by iUltimateLP »

So I finished my Teleporters Mod but now I need multiplayer support.. So the main teleporting thread is inside the game.on_tick event, but that does not give me the the player index so how do I get the player? I dont want to loop through every player every tick cause that would take lagg I think..

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Getting player index in events like ontick?

Post by ratchetfreak »

iUltimateLP wrote:So I finished my Teleporters Mod but now I need multiplayer support.. So the main teleporting thread is inside the game.on_tick event, but that does not give me the the player index so how do I get the player? I dont want to loop through every player every tick cause that would take lagg I think..
I think you kinda need to

Each player needs to simulate what every other player does

iUltimateLP
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Sun May 24, 2015 4:41 pm
Contact:

Re: Getting player index in events like ontick?

Post by iUltimateLP »

ratchetfreak wrote:
iUltimateLP wrote:So I finished my Teleporters Mod but now I need multiplayer support.. So the main teleporting thread is inside the game.on_tick event, but that does not give me the the player index so how do I get the player? I dont want to loop through every player every tick cause that would take lagg I think..
I think you kinda need to

Each player needs to simulate what every other player does
Well thanks!

SirRichie
Fast Inserter
Fast Inserter
Posts: 244
Joined: Wed Feb 25, 2015 4:50 pm
Contact:

Re: Getting player index in events like ontick?

Post by SirRichie »

I think the reason is not that every player needs to simulate what every other player does (which is true), but that on_tick is not a player-specific event. It is a global game event, which is not caused by any player action and thus, there is no player to be associated with the event.

So you'll need to loop, or be triggered by an event which supplies the player / player index.

Post Reply

Return to “Modding help”