Page 1 of 1
Disable the crash ship and force settings
Posted: Mon Nov 16, 2020 5:03 pm
by patfre
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?
Re: Disable the crash ship and force settings
Posted: Mon Nov 16, 2020 5:05 pm
by Deadlock989
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.
Code: Select all
remote.call("freeplay", "set_skip_intro", true)
remote.call("freeplay", "set_disable_crashsite", true)
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?
Re: Disable the crash ship and force settings
Posted: Mon Nov 16, 2020 5:08 pm
by patfre
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?
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.
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)
Re: Disable the crash ship and force settings
Posted: Mon Nov 16, 2020 5:35 pm
by Deadlock989
patfre wrote: Mon Nov 16, 2020 5:08 pm
Also where excatly do you have to put
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
)
For the other thing you want - it's involved. The map settings menu is governed by a bunch of things like autoplace controls and collections of presets. I don't think you can "disable" those controls. You can delete them but that itself would break things and need fixing. I'm still not clear on what it is you want - if you want a new preset for example or if you want to absolutely stop anyone from having cliffs etc. under any circumstance. Probably someone else can give you better advice about how they've handled similar things.
Re: Disable the crash ship and force settings
Posted: Mon Nov 16, 2020 6:00 pm
by PFQNiet
You can probably just do something like...
Code: Select all
data.raw['autoplace-control'] = {}
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.
Re: Disable the crash ship and force settings
Posted: Mon Nov 16, 2020 6:08 pm
by patfre
PFQNiet wrote: Mon Nov 16, 2020 6:00 pm
You can probably just do something like...
Code: Select all
data.raw['autoplace-control'] = {}
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.
Won't work game can't even start lol
Re: Disable the crash ship and force settings
Posted: Mon Nov 16, 2020 6:12 pm
by orzelek
This should work (thats what RSO does with some added exceptions):
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
It needs to be called from one of data stage files (data.lua, data-updates.lua or data-final-fixes.lua).