Jump to content

Lua Scripting Engine is on steam


Recommended Posts

I have been working a little more on it and started converting some of my mods to lua:

function start()
	DebugLog(" buildingpatches ")
	GetBuildingDef("MassiveHeatSink").Floodable = false
	GetBuildingDef("SuitLocker").Floodable = false
	GetBuildingDef("SuitMarker").Floodable = false
	GetBuildingDef("JetSuitLocker").Floodable = false
	GetBuildingDef("JetSuitMarker").Floodable = false
	GetBuildingDef("TravelTubeEntrance").Floodable = false
	
	GetBuildingDef("GasFilter").EnergyConsumptionWhenActive = 10
	GetBuildingDef("LiquidFilter").EnergyConsumptionWhenActive = 10
	
	GetBuildingDef("WireRefinedHighWattage").BaseDecor = -1
	GetBuildingDef("WireRefinedBridgeHighWattage").BaseDecor = -1
	GetBuildingComplete("StorageLocker").GetComponent("Storage").capacityKg= 100000
end

@harmonium i have also some stuff for the spaceheater, i think its balanced that way i changed it. Right now it is part of my hotter than lava mod and i will include it there but you could just take the script and copy it in a separate lua file:

sh=GetBuildingDef("SpaceHeater")
	sh.BaseMeltingPoint= 1000398.15
	sh.OverheatTemperature = 1000398.15
	sh.EnergyConsumptionWhenActive = 250
	sh.ExhaustKilowattsWhenActive = 200
	sh.SelfHeatKilowattsWhenActive = 16
	sh.Floodable = false;
	SetPrivateField("SpaceHeater, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null","targetTemperature",GetBuildingGameObject("SpaceHeater"),1000398.1)

I will upload it soon.

Link to comment
Share on other sites

@Rainbowdesign Would you be able to set how much experience is earned from ex: grill so that 1) it increases cooking stat and 2) better recipes give more experience?

There are a few mods out there that fix ranching experience and crafting experience as well increases resources dropped when you mine a block.
Would I be able to easily create a script for those different situations?

Link to comment
Share on other sites

14 hours ago, Rainbowdesign said:

Quote: There are a few mods out there that fix ranching experience and crafting experience.

Send me the links to the source.

I know, I was hoping I could create a script with Lua to do it myself and was asking if it would be possible.
Ranching, Crafting, Mining

If you can do things like this in your mod, I might just learn how to write scripts.

Link to comment
Share on other sites

This is are very specialized mod, it goes rather deep and the scripting engine will not support it out of the box.

In general the idea of lua is not to go deep in the system but to be able to control things with a few lines, like as example change a building variable easily.

However if you find a way to streamline that idea in c# you can add a lua function to control it.

 

Link to comment
Share on other sites

15 hours ago, TheExceed said:

I know, I was hoping I could create a script with Lua to do it myself and was asking if it would be possible.
Ranching, Crafting, Mining

If you can do things like this in your mod, I might just learn how to write scripts.

Those mods have runtime modded code, which should be fast. Lua isn't as fast as C# and should ideally be reserved for startup only. This means something like setting up what a critter will eat is fine in lua while how the critter will reach the food should be C#.

Luckily ONI has a decent setup for altering a whole lot of stuff at startup time, meaning there is room to do a lot with lua without losing FPS. However lua isn't the universal answer to every single mod.

I know it can be hard to figure out what is lua friendly and what isn't when you don't know the code, but that's ok. Say what you want and maybe it is doable or can be made doable. For instance my newest mod Piped Output is C# only, but (at least in theory) I can make a mod, which adds the ability to add such an output port to lua. The idea is that the C# code, which has to be C# will be added in a DLL file and then that piece of code can gain a lua interface to the setup part of the code. I don't know how to do that (at least not yet), but in theory that's possible, meaning despite lua not being used at runtime it can be used for new features.

Link to comment
Share on other sites

2 hours ago, Nightinggale said:

Those mods have runtime modded code, which should be fast. Lua isn't as fast as C# and should ideally be reserved for startup only. This means something like setting up what a critter will eat is fine in lua while how the critter will reach the food should be C#.

Luckily ONI has a decent setup for altering a whole lot of stuff at startup time, meaning there is room to do a lot with lua without losing FPS. However lua isn't the universal answer to every single mod.

I know it can be hard to figure out what is lua friendly and what isn't when you don't know the code, but that's ok. Say what you want and maybe it is doable or can be made doable. For instance my newest mod Piped Output is C# only, but (at least in theory) I can make a mod, which adds the ability to add such an output port to lua. The idea is that the C# code, which has to be C# will be added in a DLL file and then that piece of code can gain a lua interface to the setup part of the code. I don't know how to do that (at least not yet), but in theory that's possible, meaning despite lua not being used at runtime it can be used for new features.

Gotcha, that's why I was asking, I wasn't sure which was possible with lua. I assumed klei set experience and stuff like critter groomed time as a variable which could be redefined. Its been awhile since I've used c# though.

Link to comment
Share on other sites

The next version will contain tools to manipulate the map, it can already target a biome with any kind of operation like cooling it down or heating it up aswell as select an element and do operations to it.

 

Also the next version should be able to support different mod with only an entry point and the engine as requirement.

 

Right now i would need some support here:

If i have a .dll as entry point and i copy my entry point (copying the file with windows) and put it in a different folder it gets executed but when i try to get the folder and file with System.Reflection.Assembly.GetExecutingAssembly().Location.Replace(".dll", "") i always only get the folder of the first entry point why is that?

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...