Creative Mode (Fix for 0.16)


Based on the old Creative Mode mod created by Y.Petremann, then patched by Pac0master, and also the Test Mode mod created by rk84. By enabling Creative Mode in the game, you can access objects that can generate unlimited items, fluid or energy, or nullify them. Perfect for testing purpose or making initial setup for games. Quick patch for 0.16 until an official release - everything should work now.

Content
6 years ago
0.16
68
Cheats

b Compatibility with a couple other mods

6 years ago

Not 100% sure where the fault lies with these errors. One of them thinks it's here with this mod.

Two separate cases, both in use of Magic Wand. First case is in conjunction with Rampant mod, when using the wand to add/change tile types (other than ore), it will cause the below error.

87.737 Error MainLoop.cpp:1013: Exception at tick 965: Error while running event creative-mode-fix::on_player_selected_area (ID 49)
Error while running event Rampant::on_player_built_tile (ID 45)
Rampant/control.lua:411: attempt to index field 'robot' (a nil value)
stack traceback:
creative-mode-fix/scripts/util.lua:159: in function 'raise_event'
creative-mode-fix/scripts/magic-wand-creator.lua:413: in function 'create_tiles_or_resources_in_pattern'
creative-mode-fix/scripts/magic-wand-creator.lua:470: in function 'on_player_selected_area'
creative-mode-fix/scripts/events.lua:433: in function '?'
creative-mode-fix/scripts/events.lua:1113: in function <creative-mode-fix/scripts/events.lua:1048

Second case is in conjunction with this mod, Dectorio, and Bot Servicing. When using the wand to remove ore tiles, the below error is thrown. Disabling either Bot Servicing or Dectorio will solve the problem.

111.908 Error MainLoop.cpp:1013: Exception at tick 520: Error while running event creative-mode-fix::on_player_alt_selected_area (ID 50)
Error while running event Bot_Servicing::on_robot_pre_mined (ID 15)
Bot_Servicing/control.lua:59: attempt to index field 'surface' (a nil value)
stack traceback:
creative-mode-fix/scripts/util.lua:159: in function 'raise_event'
creative-mode-fix/scripts/util.lua:289: in function 'destroy_entity_and_raise_event'
creative-mode-fix/scripts/magic-wand-creator.lua:515: in function 'on_player_alt_selected_area'
creative-mode-fix/scripts/events.lua:455: in function '?'
creative-mode-fix/scripts/events.lua:1113: in function <creative-mode-fix/scripts/events.lua:1048

6 years ago
(updated 6 years ago)

Bot Servicing looks like it was recently patched to fix that error. Let me know if it's still broken with Bot Servicing 1.0.5 and I'll look into it further.

With Rampant it's partially both; CM doesn't include some event parameters (surface_index in particular) on an event it raises, which leads to an alternate code path in Rampant - due to an event handler being shared between multiple events. I'll see about fixing that on CM side.

Rampant suffered from a similar error as Bot Servicing: it doesn't check that (event.robot and event.robot.valid) in local function onSurfaceTileChange(event). Entities should always be checked for existence and validity before they are accessed - forward to the Rampant mod maintainer. I'll add the surface_index from the CM side.

As soon as the mod portal uploading works, at least...

6 years ago

Thanks. I did (prior to posting here) also post at Rampant and Bot Servicing.

New response