Page 1 of 1
Detect if player view the map
Posted: Sun Jun 10, 2018 5:05 am
by Yemto
Is there an event, or some other way to see if the player is looking at the map?
Re: Detect if player view the map
Posted: Sun Jun 10, 2018 9:59 pm
by MostlyNumbers
You can define a custom input to fire an event when they toggle map view. Something like:
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}
In control.lua
Code: Select all
script.on_event("my-custom-input", function(event)
-- Do something here
end)
Re: Detect if player view the map
Posted: Mon Jun 11, 2018 5:24 am
by eradicator
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.
Re: Detect if player view the map
Posted: Tue Jun 12, 2018 3:49 am
by MostlyNumbers
when clicking the minimap
Didn't even know that was an option!