Page 1 of 1

[1.1.67] modding related, flashlight enable/disable on LuaPlayer

Posted: Sat Aug 20, 2022 2:09 am
by Honktown
Under Luaplayer, enable_flashlight() and disable_flashlight() are listed, but do nothing. is_flashlight_enabled does translate from a character entity (and seems to return true always when there is no character e.g. editor). enable and disable flashlight work as expected on a character entity.
https://lua-api.factorio.com/1.1.67/LuaPlayer.html

I assume enable/disable should work, because they are listed under LuaPlayer and are a LuaControl, following the pattern of a number of other character+player / character entity things.

Re: [1.1.67] modding related, flashlight enable/disable on LuaPlayer

Posted: Sat Aug 20, 2022 8:03 am
by boskid
LuaControl::enable/disable_flashlight not working when used through LuaPlayer that points at a player with CharacterController was an issue and is now fixed for 1.1.68.

As for the reason why those methods are in LuaControl, they are here because they are valid for LuaEntity (in case of a Character entity) and valid for LuaPlayer (in case of an EditorController where you can read the flashlight enabled state since it can be turned off using editor's setting "draw cursor light", in case of a GodController a script can enable/disable the cursor light, and after fix the CharacterController can control the flashlight).