Detect if player view the map
Detect if player view the map
Is there an event, or some other way to see if the player is looking at the map?
-
- Inserter
- Posts: 26
- Joined: Fri Apr 13, 2018 10:07 pm
- Contact:
Re: Detect if player view the map
You can define a custom input to fire an event when they toggle map view. Something like:
In data.lua
In control.lua
In data.lua
Code: Select all
local custom_input={
type = "custom-input",
name = "my-custom-input",
key_sequence = "",
linked_game_control = "toggle-map",
consuming = "none"
}
data:extend{custom_input}
Code: Select all
script.on_event("my-custom-input", function(event)
-- Do something here
end)
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Detect if player view the map
Not sure if input actions trigger when clicking the minimap instead of pressing a button (they probably do). But, apart from that the map-open status doesn't seem to be part of the game state (i just tested) and thus you can't use it for anything that affects the game state without causing multiplayer desyncs.
-
- Inserter
- Posts: 26
- Joined: Fri Apr 13, 2018 10:07 pm
- Contact:
Re: Detect if player view the map
Didn't even know that was an option!when clicking the minimap