[Klonan] [1.0.0] Team production scenario, error with mods

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

[Klonan] [1.0.0] Team production scenario, error with mods

Post by eradicator »

Not sure if this is supposed to be my fault. Can't really detect what a scenario wants.

1) Install HCG
2) Start Team production
3) Use the item in your inventory to build a HCG in the starting area.

So basically because team production doesn't have the freeplay remote interface for setting starting items my mod automatically falls back to direct insertion, and thus the player has something buildable even though that's probably not intended.

Code: Select all

    script.on_event(defines.events.on_player_created,function(e)
      local p = game.players[e.player_index]
      local simple_stack = {name='er:hcg-item', count=1}
      if p.can_insert(simple_stack) then
        p.insert(simple_stack)
Error:

Code: Select all

The scenario level caused a non-recoverable error.
Please report this error to the scenario author.

Error while running event level::on_built_entity (ID 6)
...shared-write]/temp/currently-playing/team_production.lua:983: attempt to index field '?' (a nil value)
stack traceback:
	...shared-write]/temp/currently-playing/team_production.lua:983: in function 'is_in_area'
	...shared-write]/temp/currently-playing/team_production.lua:1055: in function 'handler'
	__core__/lualib/event_handler.lua:47: in function <__core__/lualib/event_handler.lua:45>
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: [1.0.0] Team production scenario, error with mods

Post by sparr »

What's the reasoning behind falling back to direct insertion when the interface isn't available, vs only inserting items when the scenario provides an interface for it? Most scenarios you shouldn't be giving any [extra] items at the start.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [1.0.0] Team production scenario, error with mods

Post by kovarex »

Well, the scenarios are generally not meant to be played with mods, and if so, not with mods that break it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [1.0.0] Team production scenario, error with mods

Post by eradicator »

kovarex wrote:
Mon Aug 31, 2020 10:58 am
Well, the scenarios are generally not meant to be played with mods, and if so, not with mods that break it.
Understood. I'd prefer to not break it, but without adding scenario specific extra code i don't see how i could do that. Safe for removing the fallback-insertion completely.
sparr wrote:
Mon Aug 31, 2020 2:38 am
What's the reasoning behind falling back to direct insertion when the interface isn't available, vs only inserting items when the scenario provides an interface for it? Most scenarios you shouldn't be giving any [extra] items at the start.
Honestly i don't have much experience with scenarios so i'm doing what i thought was "the right thing to do". The mod is quite old that's just "how it's always been". Also the mod is *intended* to be used as a starting item - getting the item only when you already have a base is mostly useless.

Do third-party scenarios actually provide the "freeplay" interface? Can you recommend any scenarios i can look at?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.0.0] Team production scenario, error with mods

Post by Klonan »

Its an easy fix, scenarios fault really

Fixed for 1.1

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [1.0.0] Team production scenario, error with mods

Post by eradicator »

Klonan wrote:
Mon Aug 31, 2020 12:21 pm
Its an easy fix, scenarios fault really

Fixed for 1.1
Heh. Now what :D. Ohwell, if it's fixed it's fixed.

After some thought i removed the non-freeplay-remote-interface fallback code anyway. There might be other problems like balancing or custom startup item overrides.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: [Klonan] [1.0.0] Team production scenario, error with mods

Post by sparr »

Klonan wrote:
Mon Aug 31, 2020 12:21 pm
Its an easy fix, scenarios fault really

Fixed for 1.1
Can you confirm that the fix is for the scenario to provide a "freeplay" interface if it's the sort of scenario where the player is going to be collecting resources and building a base?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Klonan] [1.0.0] Team production scenario, error with mods

Post by Klonan »

sparr wrote:
Mon Aug 31, 2020 4:25 pm
Klonan wrote:
Mon Aug 31, 2020 12:21 pm
Its an easy fix, scenarios fault really

Fixed for 1.1
Can you confirm that the fix is for the scenario to provide a "freeplay" interface if it's the sort of scenario where the player is going to be collecting resources and building a base?
That is not the fix, freeplay interface is for freeplay scenario

The scenario is team production, not freeplay, so things like setting rocket launches or starting items makes no sense

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Klonan] [1.0.0] Team production scenario, error with mods

Post by eradicator »

Well, i have no clue how scenarios out in the wild work. I certainly can't support a different remote interface for each scenario. So i'm just hoping that any scenario maker who wants to support modded starting items adds a freeplay *compatible* get/set_created_items/debris_items interface. I don't need the full interface with rockets etc.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Resolved Problems and Bugs”