Creative Mod

by jodli

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. Quick patch for 0.17 until an official release - if ever...

Content
6 days ago
0.17 - 2.0
97.6K
Cheats

b Fatal error with 0.17.35

5 years ago

I get the following error with Factorio 0.17.35.

Error while running event creative-mod::on_tick (ID 0)
real number expected got nil.
stack traceback:
creative-mod/scripts/cheats.lua:2516: in function 'get_inventory_or_slot_count_function'
creative-mod/scripts/cheats.lua:2608: in function 'apply_slot_cheat_to_players'
creative-mod/scripts/cheats.lua:2695: in function 'tick'
creative-mod/scripts/events.lua:177: in function <creative-mod/scripts/events.lua:146>
stack traceback:
[C]: in function 'get_inventory'
creative-mod/scripts/cheats.lua:2516: in function 'get_inventory_or_slot_count_function'
creative-mod/scripts/cheats.lua:2608: in function 'apply_slot_cheat_to_players'
creative-mod/scripts/cheats.lua:2695: in function 'tick'
creative-mod/scripts/events.lua:177: in function <creative-mod/scripts/events.lua:146>

5 years ago
(updated 5 years ago)

Same as well, only with the new 1.1.1 version of the mod though
Edit: never mind, 1.0.4, which worked last time now also is not working anymore. Probably a change in factorio

5 years ago

It is a Factorio change. Read my post above Taz ^^

5 years ago

Same issue, same error.

5 years ago
(updated 5 years ago)

It is a Factorio change. Read my post above Taz ^^
Can't read it if you edit your comment after I post my comment

5 years ago

But I didn't edit it. Again, read.

5 years ago
(updated 5 years ago)

I made a few little changes, renaming get_inventory() to get_main_inventory(), and it seems to at least not be crashing for me. I have no idea what I'm doing though, so no guarantees on your save file ;p

EDIT:
Don't use this. It's not crashing, but it's definitely not working right, all of my inventory is gone =D

In scripts/cheats.lua

Lines 775-776
local character_main = character.get_main_inventory()
local god_main = player.get_main_inventory()

Lines 805-806
local character_main = character.get_main_inventory()
local god_main = player.get_main_inventory()

Line 2616
return character.get_main_inventory()

5 years ago

Same here.
But if I choose "yes" (upper left option) but without all cheats enabled in the enable creative mode dialog it seems to work. The only option that crashes for me is "Instant Trash" in the personal cheats. If I leave this one at off - everything else seems to work.
Does only work for new files though - not for saved games :-(

5 years ago
character.get_inventory(defines.inventory.player_main)

should be replaced by

character.get_main_inventory()

or by

character.get_inventory(defines.inventory.character_main)

but

 character.get_inventory(defines.inventory.player_trash)

needs to be replaced by

character.get_inventory(defines.inventory.character_trash)

so replace defines.inventory.player_ with defines.inventory.character_ everywhere to make it work.
What you did is you told CM that the main inventory is the trash inventory so when it clears the trash slots it clears main inventory insetad.

5 years ago
character.get_inventory(defines.inventory.player_main)

should be replaced by

character.get_main_inventory()

or by

character.get_inventory(defines.inventory.character_main)

but

 character.get_inventory(defines.inventory.player_trash)

needs to be replaced by

character.get_inventory(defines.inventory.character_trash)

so replace defines.inventory.player_ with defines.inventory.character_ everywhere to make it work.
What you did is you told CM that the main inventory is the trash inventory so when it clears the trash slots it clears main inventory insetad.

This seems to be working perfectly, thank you!

5 years ago

With these changes, it appears that the magic wand can still remove the player character (shift to god mode) even if 'don't remove player characters' is checked.

5 years ago

Hi!
Thanks for reporting this. :)
I've pushed a new Version 1.1.2 which should fix this.
Let me know if anything else is broken. It looked fine for now...

This thread has been locked.