[MOD 0.15.29+] Creative Mode 0.3.12 - Infinite resources

Topics and discussion about specific mods
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 »

Ok I found the cause of the bug.

Same steps from above but with CM's event-logging (on_robot_built) checked (with default settings)

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 »

Nexela wrote:
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.
Fair enough.

I'm currently looking through the code of your Creative mod - because it already creates totally unbalanced units for testing anyway :) - to see if I can make a separate mini-Mod just for my game where I can just place "Super Structures" in the form of turrets that don't need either ammo or Energy, and things that can repair themselves over time without a need for setting up Roboports and feeding them with bots from a Creative Chest like I was trying to do before.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
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:Ok I found the cause of the bug.

Same steps from above but with CM's event-logging (on_robot_built) checked (with default settings)
Found the issue. Should have checked entity.valid before printing its position. The bug is caused when I'm getting the position of my invalid robot from instant blueprint.
But I have some works to do. Will release the fix within these 2 days. :mrgreen:

Nexela wrote:Also in your on_robot event the valid=false is not needed. for the same reason as above. the lack of valid is false
Because the "robot" parameter of on_robot_built_entity is not optional, people may not expect it to be nil. Even though it will still cause error if they try accessing the other entity properties, at least I can say "please check valid before accessing the properties!" :)
Nexela wrote:Just need creative mode to add (or point me to if they exsist) a way to bypass the popup and enable all cheats.
The option is in config.lua

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 »

Mooncat wrote: The option is in config.lua
I was hoping for a remote interface for it *wink*

Mooncat wrote:Because the "robot" parameter of on_robot_built_entity is not optional, people may not expect it to be nil. Even though it will still cause error if they try accessing the other entity properties, at least I can say "please check valid before accessing the properties!" :)
It doesn't hurt to have it but it is not needed.

local valid
if valid then
if valid == true then

Would both return false (not valid)

checking if valid==false is just bad practice IMO since nil and false are false :)

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
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 »

oh, you are talking the valid=false inside {}. I thought you are talking about the whole {valid=false}

I would keep it. Shouldn't expect everyone has the same standard.
And technically nil and false are not the same. valid == nil will return true only if it is nil but not false. Even tho it doesn't matter here due to the limited possible values and consequences of valid, it is a good practice to keep things that are supposed to be "not nil" not nil. :)

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.9 - Event log error fix

Post by Mooncat »

v0.2.9 has been released:
- New:
  • New option on the modifier popup: backer name.
- Fixes:
  • Fixed error when instant blueprint is performed while logging is enabled for the on_robot_built_entity event.
  • Ghost tile revival caused by Healer magic wand now invokes on_robot_built_tile instead of on_player_built_tile, for being consistent as instant blueprint.
    • the "robot" parameter will be a small table: {valid = false, type = "player", name = "player"}
    • the index of player who triggered the revival will still be stored in the "player_index" parameter
    • additional parameter "revived" whose value is true
- Improvements:
  • For the alternate mode of Modifier magic wand, the default values of "Don't select healthless entities" and "Don't select indestructible entities" are changed from true to false, making them different from the standard mode.
  • Event logging now checks the "valid" property of parameters of following types before showing some advanced properties like position, train backer name. "valid = false" will be shown if valid is false.
    • LuaEntity
    • LuaEquipment
    • LuaEquipmentGrid
    • LuaForce
    • LuaGuiElement
    • LuaSurface
    • LuaTechnology
    • LuaTrain
  • The on_robot_built_entity and on_robot_built_tile events invoked by this mod due to instant blueprint now have an additional parameter: "instant_blueprint". Its value is always true.
  • Similar to above, the on_entity_died and on_player_mined_tile events invoked by this mod due to instant deconstruction now have an additional parameter: "instant_deconstruction". Its value is always true.
@Nexela: I have tried implementing a remote API for setting the default action on the initial popup. But the existing scripts were not designed for that. It requires too much work. So I cancelled it.
But a much more powerful remote interface will come in the future. :)

If nothing goes wrong, this will be last version for 0.14 Factorio. Looking forward to 0.15 on next Tuesday. :P

For Creative Mode, here is the plan:
v0.3.0 = a quick ugly port for 0.15. Also change the on_player_mined_tile event caused by instant deconstruction to on_robot_mined_tile.
Maybe on_entity_died should be changed to on_robot_pre_mined? Let me know what do you think about this. :)

v0.3.1 = graphics update, base on the new 0.15 icons. Also use the new mod GUI API if possible. But no big change on the layout. (May need a few weeks)

v0.4.0 = Huge overhaul. Use a proper IDE for scripting. Better layout (e.g. group the cheats into foldouts). More powerful remote interface. I'm planning an interface to let other mods to set the states of cheats, or even add more cheats. (2-3 months)
Last edited by Mooncat on Sat Apr 22, 2017 9:27 am, edited 1 time in total.

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.9 - Event log error fix

Post by Nexela »

the "robot" parameter will be nil
nil? or empty table

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.9 - Event log error fix

Post by Nexela »

Ohhhh the modifier changes are in!!! And they don't do what I thought they did. I wasn't aware it was a history thing :P

I will wait patiently for the better remote api :)
Alternatively .15 config settings will work too, I just hate having to remember to update config.lua when you release new goodies

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.9 - Event log error fix

Post by Mooncat »

Nexela wrote:
the "robot" parameter will be nil
nil? or empty table
oh shit. Typo. It should be the fake robot table: {valid = false, type = "player", name = "player"}
Fixed. ;)
Nexela wrote:Ohhhh the modifier changes are in!!! And they don't do what I thought they did.
What did you think they do?
Nexela wrote:Alternatively .15 config settings will work too, I just hate having to remember to update config.lua when you release new goodies
I will see if that is easy to implement. If not, it will be in 0.3.1.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.9 - Event log error fix

Post by Mooncat »

Just updated the wiki page about remote interface:
http://factorio-creative-mode.wikia.com ... _Interface

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.9 - Event log error fix

Post by impetus maximus »

Mooncat, don't know where you are with 0.15 compatibility.... but i ran 0.15.0 and trying to install your mod i get
"Selected mod has no release version."

cheers

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.9 - Event log error fix

Post by Mooncat »

impetus maximus wrote:Mooncat, don't know where you are with 0.15 compatibility.... but i ran 0.15.0 and trying to install your mod i get
"Selected mod has no release version."

cheers
It was mid night here when 0.15 was released, and it is 10am now.... please wait until I get home. ^^"

User avatar
ZombieMooose
Filter Inserter
Filter Inserter
Posts: 289
Joined: Mon Feb 09, 2015 7:23 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.9 - Event log error fix

Post by ZombieMooose »

Mooncat wrote:It was mid night here when 0.15 was released, and it is 10am now.... please wait until I get home. ^^"
Cheers. I'm waiting patiently =)
"men will literally learn everything about ancient Rome instead of going to therapy"

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.9 - Event log error fix

Post by impetus maximus »

not rushing you friend.

mavzor
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue May 06, 2014 11:03 am
Contact:

Re: [MOD 0.14.13+] Creative Mode 0.2.9 - Event log error fix

Post by mavzor »

Mooncat wrote:
impetus maximus wrote:Mooncat, don't know where you are with 0.15 compatibility.... but i ran 0.15.0 and trying to install your mod i get
"Selected mod has no release version."

cheers
It was mid night here when 0.15 was released, and it is 10am now.... please wait until I get home. ^^"
There's a fair bit to adjust to.

Energy is the first one.
Unfortunately stripping out all energy features doesn't do it.

User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1190
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [MOD 0.15.1+] Creative Mode 0.3.0 - Update for 0.15!

Post by Mooncat »

Released v0.3.0 for Factorio 0.15!
Changelog
It is just a quick, ugly update, to let people use the mod in 0.15 ASAP. Please expect bug, and report if you encounter one. :)
Don't print log for the on_train_created event or error will be thrown due to this bug: viewtopic.php?f=7&t=44883

User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: [MOD 0.15.1+] Creative Mode 0.3.0 - Update for 0.15!

Post by impetus maximus »

you rock! thank you 8-)

mavzor
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue May 06, 2014 11:03 am
Contact:

Re: [MOD 0.15.1+] Creative Mode 0.3.0 - Update for 0.15!

Post by mavzor »

Error while running event creative-mode::on_tick (ID 0)
__creative-mode__/scripts/util.lua:177: attempt to index local 'item' (a number value)

When enabling instant construction/blueprint laying and applying a blueprint

User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: [MOD 0.15.1+] Creative Mode 0.3.0 - Update for 0.15!

Post by impetus maximus »

mavzor wrote:Error while running event creative-mode::on_tick (ID 0)
__creative-mode__/scripts/util.lua:177: attempt to index local 'item' (a number value)

When enabling instant construction/blueprint laying and applying a blueprint
0.15.2?

HiddenWolf
Inserter
Inserter
Posts: 48
Joined: Thu Sep 24, 2015 1:37 pm

Re: [MOD 0.15.1+] Creative Mode 0.3.0 - Update for 0.15!

Post by HiddenWolf »

impetus maximus wrote:
mavzor wrote:Error while running event creative-mode::on_tick (ID 0)
__creative-mode__/scripts/util.lua:177: attempt to index local 'item' (a number value)

When enabling instant construction/blueprint laying and applying a blueprint
0.15.2?
I have the same error when I load my design/cheat save started in 0.14.

In a quick test, enabling cheat mode on a new save and copy-pasting fresh blueprints around does not result in the crash.

Post Reply

Return to “Mods”