Page 1 of 1

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

Posted: Mon Aug 31, 2020 2:27 am
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>

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

Posted: Mon Aug 31, 2020 2:38 am
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.

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

Posted: Mon Aug 31, 2020 10:58 am
by kovarex
Well, the scenarios are generally not meant to be played with mods, and if so, not with mods that break it.

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

Posted: Mon Aug 31, 2020 11:31 am
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?

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

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

Fixed for 1.1

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

Posted: Mon Aug 31, 2020 2:03 pm
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.

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

Posted: Mon Aug 31, 2020 4:25 pm
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?

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

Posted: Mon Aug 31, 2020 6:22 pm
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

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

Posted: Mon Aug 31, 2020 6:51 pm
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.