[MOD 0.15.29+] Creative Mode 0.3.12 - Infinite resources

Topics and discussion about specific mods
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.7 - Instant Blueprint Fix

Post by Mooncat »

Nexela wrote:Sending valid=false will cause the scripts to not do what they are supposed too though even if checking for .valid

on_robot_mined -- if robot.valid then replace item with new item end
Now this doesn't fire and the item I was trying to replace doesn't get replaced

So I would have to add explicit support for creative mode by adding additional logic checks that are not needed

Sending the player as the robot should have no ill effects on anything. I even do/did it in a few mods.
No. I don't touch on_robot_mined. I only invoke on_robot_built_entity/tile for entity revival by instant blueprint or the magic wands, because in normal gameplay, there is no way a player can revive a ghost entity. Earendel has used this characteristic to make his Text Plates mod efficient.
I don't want sending player as "robot" because I don't want other mods to misassume that it is really a robot and.... let's say, robot.destroy(). (e.g. the entity is so dangerous that if a robot build it, the robot will be destroyed immediately.)
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Mooncat »

Released v0.2.8.
Changelog
Usually I don't release small and frequent updates. But I have the responsibility to avoid causing problems on other mods due to sending expected "nil" in the "robot" parameter. Therefore, here is the fix. (Haven't got the time to do this sooner.)
I have also just found that the creative labs cannot recognize the new science packs from the Research Revolution mod. So I fixed it. :)
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by impetus maximus »

[edit] nevermind. i wound up using a bunch of spawners outside the lasers reach to spawn infinite biters.

i'm trying to help someone with a power solution. they want to be able to support 10 lasers fire at once.
what i need is something that cannot die for the lasers to shoot at. when i make it indestructible via magic wand, the lasers don't fire at it.

anyone have a solution?
thanks
tommygunner70
Inserter
Inserter
Posts: 26
Joined: Fri Mar 04, 2016 2:22 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by tommygunner70 »

the new version (0.2.8) is incompatible with Surfaces remake 0.0.8 ( https://mods.factorio.com/mods/Erdbeerb ... ces_remake )
its the fault of Surfaces remake I think as Surfaces remake also causes incompatibility with Satellite Uplink Station 1.0.6
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Mooncat »

impetus maximus wrote:[edit] nevermind. i wound up using a bunch of spawners outside the lasers reach to spawn infinite biters.
Glad you have found the solution. I have planned to make a programmable spawner in 0.15. Its GUI will look very similar to the one in FFF #166. ;)

tommygunner70 wrote:the new version (0.2.8) is incompatible with Surfaces remake 0.0.8 ( https://mods.factorio.com/mods/Erdbeerb ... ces_remake )
its the fault of Surfaces remake I think as Surfaces remake also causes incompatibility with Satellite Uplink Station 1.0.6
Thanks for the report. Yes, you are right. Surfaces caused the error. But it is easy to fix.
In its script/lib/util.lua, please change line 16 from

Code: Select all

util = {}
to

Code: Select all

if not util then util = {} end
The original line of code overrides the whole util library from vanilla Factorio, making other mods to throw error when accessing the functions in it, like util.table.deepcopy
The updated code only create a new instance of util if it has not existed yet.
This should fix the compatibility issue for Creative Mode, and probably also other mods.
I have also posted this on its discussion board on Mod Portal, hope the author will see that. ;)
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by impetus maximus »

Mooncat wrote:
impetus maximus wrote:[edit] nevermind. i wound up using a bunch of spawners outside the lasers reach to spawn infinite biters.
Glad you have found the solution. I have planned to make a programmable spawner in 0.15. Its GUI will look very similar to the one in FFF #166. ;)
sounds great. would be great to lay enemy spawners without laying a friendly one, that spawns friendly biters, then switching the the spawner to enemy to have my biters attacking it. lol

love the work you're doing with this mod. glad to see you can fix other mods as well. bravo ;)
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by steinio »

Hello,

is it possible to enable instant blueprint/autottrash/... without enabling instant hand crafting?

Also with instant handcrafting enabled, the crafting maschines are not shown (because you can build it by hand) - maybe a key combo to enable/disable it could help.

Edit: Well it works like planned if i disable cheat mode in personal chats.
I just wondered because an instant blueprint was not built completely but the avatar was in the way of the to place object.

Greetings steinio
Last edited by steinio on Sun Mar 26, 2017 10:18 pm, edited 2 times in total.
Image

Transport Belt Repair Man

View unread Posts
tommygunner70
Inserter
Inserter
Posts: 26
Joined: Fri Mar 04, 2016 2:22 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by tommygunner70 »

Mooncat wrote:
tommygunner70 wrote:the new version (0.2.8) is incompatible with Surfaces remake 0.0.8 ( https://mods.factorio.com/mods/Erdbeerb ... ces_remake )
its the fault of Surfaces remake I think as Surfaces remake also causes incompatibility with Satellite Uplink Station 1.0.6
Thanks for the report. Yes, you are right. Surfaces caused the error. But it is easy to fix.
In its script/lib/util.lua, please change line 16 from

Code: Select all

util = {}
to

Code: Select all

if not util then util = {} end
The original line of code overrides the whole util library from vanilla Factorio, making other mods to throw error when accessing the functions in it, like util.table.deepcopy
The updated code only create a new instance of util if it has not existed yet.
This should fix the compatibility issue for Creative Mode, and probably also other mods.
I have also posted this on its discussion board on Mod Portal, hope the author will see that. ;)
that sorted it. thanks.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Optera »

In lua this is quite a bit faster than if then blocks.

Code: Select all

util = util or {}
It should be used for everything that doesn't have false as valid content.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Mooncat »

Optera wrote:In lua this is quite a bit faster than if then blocks.

Code: Select all

util = util or {}
It should be used for everything that doesn't have false as valid content.
Good to know that this is actually faster than if-then!
Though I think I will stick with if-then because of better readability and the performance gain should be small for these small operations.
This x = x or y thing has wasted me quite some time for debugging due to false contents, so I'm a bit afraid of using it now. :oops: :lol:
Taurondir
Inserter
Inserter
Posts: 43
Joined: Tue Apr 05, 2016 9:34 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Taurondir »

Just checking to see if I'm doing something wrong:

I started a game with a mate on which I'm doing a "gradual" adding of mods with renamed save games at each stage so I can roll back if needed.

I added Creative Mode about 30 hours in so we could do extra tests, mate had access to Creative tab. About ten hours past that I tried setting everything in the Access Menu to "Admin Only", told my mate to re-log and when he came back he was missing the top area button, but the "Creative" Crafting Tab was still accessible by him.

My intention down the line was to change teams via something like SpaceBook in order to add Enemy owned bases - as in, Blueprint ready full enemy Factorio DeathStars for players to take over, by putting them in via the Creative Mode mod, so I need to make sure they never have access/never get options to use Creative, only me, the Admin. Should I have done something different at the start? Can I still launch a command to remove that Creative crafting tab for everyone that has already had it?

I hope what I'm saying makes sense.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Mooncat »

Taurondir wrote:Just checking to see if I'm doing something wrong:

I started a game with a mate on which I'm doing a "gradual" adding of mods with renamed save games at each stage so I can roll back if needed.

I added Creative Mode about 30 hours in so we could do extra tests, mate had access to Creative tab. About ten hours past that I tried setting everything in the Access Menu to "Admin Only", told my mate to re-log and when he came back he was missing the top area button, but the "Creative" Crafting Tab was still accessible by him.

My intention down the line was to change teams via something like SpaceBook in order to add Enemy owned bases - as in, Blueprint ready full enemy Factorio DeathStars for players to take over, by putting them in via the Creative Mode mod, so I need to make sure they never have access/never get options to use Creative, only me, the Admin. Should I have done something different at the start? Can I still launch a command to remove that Creative crafting tab for everyone that has already had it?

I hope what I'm saying makes sense.
The crafting tabs are shared among the same force, meaning that if you see certain crafting tabs, all other players in your force also have the same tabs. It is a limit from the game.
If you want to keep the Creative Tools crafting tab for yourself while disabling it for other players, you will need to separate you and the players into 2 forces, and then change the accessibility of the crafting tab via Cheats -> Team Cheats -> Creative Tools' recipes. ;)
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Nexela »

I broke instant blueprint :)

Code: Select all

 670.772 Error MainLoop.cpp:788: Exception at tick 77931: Error while running event on_tick (ID 0)
Error while running event on_robot_built_entity (ID 14)
__creative-mode__/scripts/events.lua:471: attempt to index field 'position' (a nil value)
stack traceback:
	__creative-mode__/scripts/util.lua:152: in function 'raise_event'
	__creative-mode__/scripts/util.lua:204: in function 'revive_entity_ghost_and_raise_event'
	__creative-mode__/scripts/cheats.lua:2541: in function 'tick'
	__creative-mode__/scripts/events.lua:147: in function <__creative-mode__/scripts/events.lua:100>
Blueprint contains 2 entities

in on_built/robot built
I call revive (or create if not present in bp) on one of the entities (hidden/not craftable item) as well as create another entity.
Taurondir
Inserter
Inserter
Posts: 43
Joined: Tue Apr 05, 2016 9:34 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Taurondir »

I don't know if what I am about to ask is easy or hard to do, but I'm pretty sure you would know instantly, based on the amount of work in the Mod and the Magic Wand tools.

I'm adding custom "enemy bases" to a map so players that expand that far have to fight and kill all the defenses to use the area. Dropping an "Active Energy Source" next to a bunch of turrets and an indestructible "Super Energy Pole" or a "Duplicating Chest" full of ammo and then turrets, gives me the instant ability to put down a base full of guns to shoot players.

Now, when accessed by a player (on a force set as enemy), the Duplicating Chest will return "Can't Open Enemy Structures", meaning that a player that takes over the base does not have access to Infinite ammo or other infinite resources, but they CAN drop a power pole next to an Active Energy Source and have infinite electricity.

Can a flag be set or a condition be set so that when an "enemy" connects to a power source no connection is made or no energy is transmitted to stop them doing this?
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Nexela »

Taurondir wrote:I don't know if what I am about to ask is easy or hard to do, but I'm pretty sure you would know instantly, based on the amount of work in the Mod and the Magic Wand tools.

I'm adding custom "enemy bases" to a map so players that expand that far have to fight and kill all the defenses to use the area. Dropping an "Active Energy Source" next to a bunch of turrets and an indestructible "Super Energy Pole" or a "Duplicating Chest" full of ammo and then turrets, gives me the instant ability to put down a base full of guns to shoot players.

Now, when accessed by a player (on a force set as enemy), the Duplicating Chest will return "Can't Open Enemy Structures", meaning that a player that takes over the base does not have access to Infinite ammo or other infinite resources, but they CAN drop a power pole next to an Active Energy Source and have infinite electricity.

Can a flag be set or a condition be set so that when an "enemy" connects to a power source no connection is made or no energy is transmitted to stop them doing this?
That is not something that can not be done currently. What you can do as a work around is in on entity died, check for existing enemies in the area and if none are present destroy() the power source.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Mooncat »

Nexela wrote:I broke instant blueprint :)
...
in on_built/robot built
I call revive (or create if not present in bp) on one of the entities (hidden/not craftable item) as well as create another entity.

I can't reproduce it here with the following script:

Code: Select all

local function create_or_revive_entity(created_entity)
	if created_entity.name == "entity-ghost" then
		-- Revive wooden chest.
		if created_entity.ghost_name == "wooden-chest" then
			created_entity.revive()
		end
	elseif created_entity.name == "iron-chest" then
		-- Create a wooden chest whenever an iron chest is built.
		created_entity.surface.create_entity
		{
			name = "wooden-chest",
			position = created_entity.position,
			force = created_entity.force
		}
	end
end


script.on_event(defines.events.on_robot_built_entity, function(event)
	create_or_revive_entity(event.created_entity)
end)

script.on_event(defines.events.on_built_entity, function(event)
	create_or_revive_entity(event.created_entity)
end)
Can you show me yours? :)

Taurondir wrote:Can a flag be set or a condition be set so that when an "enemy" connects to a power source no connection is made or no energy is transmitted to stop them doing this?
See Nexela's answer.
Energy network does not have force, meaning that if 2 networks connect to each other, the energy will be shared regardless of their forces. This is a known issue, but is marked as "not a bug": viewtopic.php?f=23&t=21493&p=136397
(Hopefully they will review it for 0.15?)
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Nexela »

https://github.com/Nexela/Nanobots/blob ... e.lua#L200


To test in game, clone the reorganize branch to Nanobots_1.7.0 Start a new game with creative mode enable all.
Place a roboport-interface, Make a blueprint of the interface (it should include the roboport and interface entities) Place the BP with instant blueprint



Also another potential small bug. Instant deconstruction ignores not-deconstructable flag
This is a problem if destory and die both run different actions. Currently I work around this by checking for cretive-mode in event.mod :)
https://github.com/Nexela/Nanobots/blob ... e.lua#L184
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Mooncat »

Nexela wrote:Also another potential small bug. Instant deconstruction ignores not-deconstructable flag
Instant deconstruction only works after the entity is marked for deconstruction. But entities with "not-deconstructable" flag cannot be marked. So this shouldn't be a problem.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Mooncat »

Nexela wrote:To test in game, clone the reorganize branch to Nanobots_1.7.0 Start a new game with creative mode enable all.
Place a roboport-interface, Make a blueprint of the interface (it should include the roboport and interface entities) Place the BP with instant blueprint
hm... maybe the error is caused by another mod?
NoProblemsHere.gif
NoProblemsHere.gif (3.03 MiB) Viewed 9838 times
btw, very convenient testing environment!
After checking the Minecraft 1.12 creative mode update, I had an idea about saving/loading inventory. Should be very handy. :lol:
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.8 - Instant Blueprint Fix

Post by Nexela »

Hmmm.. At least the list of mods in my development environment are small so it should help me narrow it down.


Mooncat wrote:Instant deconstruction only works after the entity is marked for deconstruction. But entities with "not-deconstructable" flag cannot be marked. So this shouldn't be a problem.
Oh you are correct not a bug just an issue to watch out for. I was recalling it from the top of my head and I was wrong. The problem was instant deconstruct raises on_died on the main interface. However I actually use on_died to trigger the actual death of the sub elements. Thankfully you added the mod-name to the event,

In your next release can you go one-step further and also add event.instant_deconstruction = true to the event (also same for instant blueprint) False isn't needed as the lack of variable is false enough.

Also in your on_robot event the valid=false is not needed. for the same reason as above. the lack of valid is false :)
Mooncat wrote:btw, very convenient testing environment!

I want to expand it further, Just need creative mode to add (or point me to if they exsist) a way to bypass the popup and enable all cheats. As well as remote apis to enable/disable certain cheats (i.e instant BP/DC)

Also there is another hidden testing feature
run /c remote.call("nanobots", "console") to open up a console window using the nanobots global environment. If you want to add something like this to CM feel free to snag the console.lua file :) simple inclusion is to just require it directly via your interfaces i.e interface.console = require("console")

And one more request. On the modifier wand currently the defaults for regular and alt-mode are the same. Can the defaults for alt-mode uncheck the two options under select player (0 health and I can't remember what the other was off the top of my head)

I always have to remember to open up the wand menu and change those options
Post Reply

Return to “Mods”