Modify the "tutorial" player?
Posted: Wed Apr 26, 2023 3:53 pm
So, I have made a mod which reduces the players reach to 1 tile.
However, this also breaks all the tutorial demonstrations, for instance the "place power poles by dragging" tutorial, as the click instead says "not enough range" rather than actually showing the action.
I decided to fix this, and tried to do so by setting the players reach to a huge number when the tutorial GUI was open
However, it still refuses to work and still has the same super short range in the tutorial pane.
However, this also breaks all the tutorial demonstrations, for instance the "place power poles by dragging" tutorial, as the click instead says "not enough range" rather than actually showing the action.
I decided to fix this, and tried to do so by setting the players reach to a huge number when the tutorial GUI was open
Code: Select all
-- Because we are modifying the players reach, this will break the tutorial screens
-- Here, we can fix it
--Subscribe to gui events so we can fix the reach in the tutorials screen
script.on_event(defines.events.on_gui_opened, TutorialOpen)
script.on_event(defines.events.on_gui_closed, TutorialClose)
local function TutorialOpen(event)
if event["gui_type"] == defines.gui_type.tutorials then
for i, player in pairs(game.players) do
FixTutorialReach(player)
end
end
end
local function TutorialClose(event)
if event["gui_type"] == defines.gui_type.tutorials then
for i, player in pairs(game.players) do
ResetReach(player)
end
end
end
function FixTutorialReach(player)
player.character_build_distance_bonus = 100
player.character_item_drop_distance_bonus = 100
player.character_item_pickup_distance_bonus = 100
player.character_loot_pickup_distance_bonus = 100
player.character_reach_distance_bonus = 100
player.character_resource_reach_distance_bonus = 100
end