Getting player index in events like ontick?
-
- Long Handed Inserter
- Posts: 66
- Joined: Sun May 24, 2015 4:41 pm
- Contact:
Getting player index in events like ontick?
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..
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: Getting player index in events like ontick?
I think you kinda need toiUltimateLP 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..
Each player needs to simulate what every other player does
-
- Long Handed Inserter
- Posts: 66
- Joined: Sun May 24, 2015 4:41 pm
- Contact:
Re: Getting player index in events like ontick?
Well thanks!ratchetfreak wrote:I think you kinda need toiUltimateLP 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..
Each player needs to simulate what every other player does
Re: Getting player index in events like ontick?
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.
So you'll need to loop, or be triggered by an event which supplies the player / player index.