So i have some code and because of the crash ship it breaks because the default inventory happens later so i have the default items and i don't want the ship.
So can someone help?
Also when starting a new game there's all those settings like how much iron, coal, copper, uranium and oil to spawn and how big the bitters bases are and the polution factor and such.
So i am asking is that a way to force these settings. If so do would you do so?
Disable the crash ship and force settings
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Disable the crash ship and force settings
For the former, there are remote interface calls to the "freeplay scenario" which let you turn those things off. There are other commands to change the starting inventory items and what items you get when you die and respawn.
The latter - I'm not 100% clear about what you're asking for. You want the game to ignore all of those settings and just override them? Or do you want the player to see that they are now unavailable somehow?
Code: Select all
remote.call("freeplay", "set_skip_intro", true)
remote.call("freeplay", "set_disable_crashsite", true)
Re: Disable the crash ship and force settings
What i mean is that i want to settings like all ores to be off and bitters off and cliffs off and i want it to be so that the player can't change the settings.Deadlock989 wrote: Mon Nov 16, 2020 5:05 pm The latter - I'm not 100% clear about what you're asking for. You want the game to ignore all of those settings and just override them? Or do you want the player to see that they are now unavailable somehow?
Also where excatly do you have to put
Code: Select all
remote.call("freeplay", "set_skip_intro", true)
remote.call("freeplay", "set_disable_crashsite", true)
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Disable the crash ship and force settings
I do it in on_init() from control.lua.
Code: Select all
script.on_init(
if remote.interfaces["freeplay"] then
remote.call("freeplay", "set_skip_intro", true)
remote.call("freeplay", "set_disable_crashsite", true)
remote.call("freeplay", "set_respawn_items", {}) -- nothing
remote.call("freeplay", "set_created_items", {"list","of","items"})
end
)
Re: Disable the crash ship and force settings
You can probably just do something like...
Basically just delete all the autoplace controls. That should remove them from the map generator settings, but it will also... y'know, not autoplace any of them. So you'd have to manage that yourself. Probably not the best idea I've had all day...
But if you do have some kind of resource placement system in your mod, and don't want the map settings to interfere, then that'll work.
Code: Select all
data.raw['autoplace-control'] = {}
But if you do have some kind of resource placement system in your mod, and don't want the map settings to interfere, then that'll work.
Re: Disable the crash ship and force settings
Won't work game can't even start lolPFQNiet wrote: Mon Nov 16, 2020 6:00 pm You can probably just do something like...
Basically just delete all the autoplace controls. That should remove them from the map generator settings, but it will also... y'know, not autoplace any of them. So you'd have to manage that yourself. Probably not the best idea I've had all day...Code: Select all
data.raw['autoplace-control'] = {}
But if you do have some kind of resource placement system in your mod, and don't want the map settings to interfere, then that'll work.
Re: Disable the crash ship and force settings
This should work (thats what RSO does with some added exceptions):
It needs to be called from one of data stage files (data.lua, data-updates.lua or data-final-fixes.lua).
Code: Select all
local zeroExpression = {
expression_id = "literal-number:1",
literal_value = 0,
type = "literal-number"
}
function resetRichness(ent)
if ent and ent.autoplace then
ent.autoplace.richness_multiplier = null
ent.autoplace.richness_expression = zeroExpression
ent.autoplace.probability_expression = zeroExpression
end
end
for _, resource in pairs(data.raw.resource) do
resetRichness(resource)
end