How to base a surface on a LuaSurfacePrototype?

Place to get help with not working mods / modding interface.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1737
Joined: Sun Oct 14, 2018 8:13 am
Contact:

How to base a surface on a LuaSurfacePrototype?

Post by Pi-C »

I've some surfaces that are strictly for mod-internal purposes, not intended to be visited by players. But the surfaces I've created are visible in the "Surfaces" GUI from Remote view. So, I want to hide my surfaces.

Luckily we now have the LuaSurfacePrototype, where we can set the properties 'hidden' and 'hidden_in_factoriopedia', so I've defined a surface prototype where these properties are set to "true". The new prototype shows up alright in the in-game prototype browser. But how do I use it?

I can't seem to find a way to apply my new surface prototype when I create a LuaSurface in the control stage. Does anybody have an idea how to do that?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Xorimuth
Filter Inserter
Filter Inserter
Posts: 700
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: How to base a surface on a LuaSurfacePrototype?

Post by Xorimuth »

Pi-C wrote: Fri Oct 25, 2024 9:23 am I've some surfaces that are strictly for mod-internal purposes, not intended to be visited by players. But the surfaces I've created are visible in the "Surfaces" GUI from Remote view. So, I want to hide my surfaces.

Luckily we now have the LuaSurfacePrototype, where we can set the properties 'hidden' and 'hidden_in_factoriopedia', so I've defined a surface prototype where these properties are set to "true". The new prototype shows up alright in the in-game prototype browser. But how do I use it?

I can't seem to find a way to apply my new surface prototype when I create a LuaSurface in the control stage. Does anybody have an idea how to do that?
LuaSurfacePrototypes are only for use as space platforms. You want https://lua-api.factorio.com/stable/cla ... ace_hidden instead.
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Pi-C
Smart Inserter
Smart Inserter
Posts: 1737
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to base a surface on a LuaSurfacePrototype?

Post by Pi-C »

Thank you, I'll try that! I didn't even think of looking for hiding surfaces in LuaForce …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
jamiechi1
Filter Inserter
Filter Inserter
Posts: 273
Joined: Wed Jan 03, 2018 10:12 pm

Re: How to base a surface on a LuaSurfacePrototype?

Post by jamiechi1 »

"You want https://lua-api.factorio.com/stable/cla ... ace_hidden instead."

I am having difficulty understanding the syntax of the documentation for the LUA classes.
I see the '::' (double quote thing) all over. What does it mean?
I searched the internet and have only found reference to '::=' which appears to be something else.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3719
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to base a surface on a LuaSurfacePrototype?

Post by DaveMcW »

:: is just a separator between the name and type of the variable. This is a factorio.com convention, it is not a standard usage in any programming language.
User avatar
jamiechi1
Filter Inserter
Filter Inserter
Posts: 273
Joined: Wed Jan 03, 2018 10:12 pm

Re: How to base a surface on a LuaSurfacePrototype?

Post by jamiechi1 »

Thanks. I would prefer to see it how I would actually code it. The documentation in Factorio is a bit confusing.
And I have been programming since 1976 (First year in college). And many years working at Microsoft.
I think the documentation needs a bit of work. Part of this may be the translation from whatever language the Developers use, to English.
Post Reply

Return to “Modding help”