Page 1 of 1

[Genhis][2.0.55] Losing in a tips and tricks simulation forces restart of the save

Posted: Wed Jun 11, 2025 9:17 pm
by Osmo
Create a mod with the following code in data-updates.lua

Code: Select all

local simulation =
{
  init =
  [[
    require("__core__/lualib/story")
    player = game.simulation.create_test_player{name = "big k"}
	  player.teleport({-9, 5.5})
    game.simulation.camera_player = player
    game.simulation.camera_position = {0, 0.5}
    game.simulation.camera_player_cursor_position = player.position
    game.surfaces[1].create_entities_from_blueprint_string
    {
      string = "0eNqtmNFyoyAUht+Fa+wIgjF5lU4mQ5R0mUV0ELub7eTdF0yj7Ra3ObS5MYp+58Dhx19e0FGPsrfKOLR7QaruzIB2jy9oUE9G6HDNnXuJdkg52SKMjGjDmbPCDH1nXXaU2qELRso08jfakcseI2mcckpeSdPJ+WDG9iitv2FmDJ0WNuuFkdqD+27wz3QmhPScjPIHjtEZ7coHfrngDxy6cFqhdSa1rJ1VddZ3WsZ4xStvE+cVM0/U9diOWrjOxjjkSokx2MxQ5qSMb8rqH3JwEUyRv6az9eng+f7DIJ1T5mkI91nZds/yMPo27aSVzSEUwTedhB4kRtfL11G+5d48C1PLJquVrUcVItfdGIpL8xyjtmumu1ympZjyWsoW6xB/06FBWh8tNiLbd11plPWVmNqJL5LvgbWqkYfBifrnYVB/ZAj3MVa5NrkiEau1iCwC3gDAGwi4AoBLCHgLAHMImOQAMgORCYBcgMgUQKYgcgEgExCZAcg5iMzvJ5MtiAwQIAEJkAAUSEAKJAAJEpAECUCDBKQUCtAgAambAjRIQEqhAA0SkLopQIMEpBQK0CABqZsCNAgSCgVIEKRtClAgSCYUIECQsumiP92JJmo81nB49qymH4M5/Wj2coBT+4JRc3aUUbNJgO61uE3QMFOjRJrgPSfYt/Wp+LxioapL3H+c4qdFY1DLf5vKYeGIpswTrGEs+Ri7THCH97IXOZ+8jc/+Z875Z2NQJZjNe/Pc3vX9wN6m+I5aAb4fWIq3vbMjLMXd3sumKewiXk1WpMDoCoylwPgKjKfA2ApsEde8CEgj7dPZa8HPspOoo6tocaVufFmO4+kk7W0+5fMvFm2TvFqvbF6wKmUwVnYu2DYFtpIZB7wZF9j3bmJch7czfoC/aRuD3LUOzd2pvrIOcZo6W+jKEs0L6IuPvyPuMfrl+xLG+JFijv2LlO/xozchHPu5Hf6HA/aZh//hgH1MvvcPTtt+uze7hBj5gRimYLQirCp4WZaM84pcLn8BFfCgsA==",
      position = {-2, 4},
    }
    pole = game.surfaces[1].find_entity("small-electric-pole", {-9.5, 1.5})
    local story_table =
    {
      {
        {
          name = "start",
          condition = function() return game.simulation.move_cursor({position = pole.position, speed = 0.1}) end
        },
        {
          condition = story_elapsed_check(0.25),
          action = function() player.opened = pole end
        },
        {
          condition = function() return game.simulation.move_cursor({position = player.position, speed = 0.1}) end
        },
      }
    }
    tip_story_init(story_table)
  ]]
}

data:extend{{
  type = "tips-and-tricks-item",
  name = "test",
  starting_status = "suggested",
  simulation = simulation
}}

data.raw["utility-constants"]["default"].main_menu_simulations = {simulation}
When a simulations finishes, you are presented with this window
изображение.png
изображение.png (280.59 KiB) Viewed 632 times
All of the options force you to exit the save.
In the main menu, the screen is only greyed out, which is ok. In tips and tricks it should either do the same, or the window should be shown in the simulation itself, not the actual world.

Re: [Genhis][2.0.55] Losing in a tips and tricks simulation forces restart of the save

Posted: Wed Sep 17, 2025 1:41 pm
by Genhis
Thanks for the report, this is fixed for 2.0.67. Simulations won't be allowed to access `game.set_game_state()` and `game.reset_game_state()`.