Hey orzelek,
Any chance you can grant outside access to your isInStartingArea function? I have an infinite resource mod that I just added a setting for applying only to starting area resources. While I'm still trying to figure out how exactly to determine that in regards to vanilla seems the starting area slider doesn't apply to resources, I did want to get it to work with your mod as well.
API request :)
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
API request :)
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: API request :)
This might not be difficult but are you prepared to handle multiple starting areas that this function will take into account?
I'd also need to figure out how to ensure that passed surface index points to something that actually exists - I'm not sure how game behaves if you ask for surface that doesn't exist.
Hmm opsie. Scratch above - this function relies on internally held table of surface data. So publishing it might not be that easy since you have no idea about that table and I'd need to somehow map function input to that table and it doesn't have even surface name I think.
Actually I checked when looking at the other API and I'm using game surface index to index my table. So this might be doable. Multiple starting areas remaing a valid question altho I have no idea if anyone out there is using that.
Actually I checked when looking at the other API and I'm using game surface index to index my table. So this might be doable. Multiple starting areas remaing a valid question altho I have no idea if anyone out there is using that.
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: API request :)
Without looking back into the code, my memory of the function was that I feed it a surface index and x/y coords that I want it to check. It then handles all of the checking and returns true if it's in any starting area, if I understood it correctly. This is perfectly fine for me and my use.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: API request :)
Thats correct. The thing is it's checking the main starting area but also all other custom starting areas that can be added to RSO. There is a big chance no-one is actually using those.FuryoftheStars wrote: ↑Tue Jan 04, 2022 6:47 pm Without looking back into the code, my memory of the function was that I feed it a surface index and x/y coords that I want it to check. It then handles all of the checking and returns true if it's in any starting area, if I understood it correctly. This is perfectly fine for me and my use.
Re: API request :)
Added access to isInStartingArea in 6.2.12.
Let me know if it works properly.
It requires surface index (can be read from game surface index property) and tile coordinates x,y.
Let me know if it works properly.
It requires surface index (can be read from game surface index property) and tile coordinates x,y.
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: API request :)
Thanks. Haven't had a chance to try yet, but hopefully soon.
Question, regarding vanilla, does the game technically only have 1 start position? How does it handle competitive MP? At the moment, I'm checking to see if something is outside of the start area with this
But that makes the assumption of only 1 start point at {0,0}.
Question, regarding vanilla, does the game technically only have 1 start position? How does it handle competitive MP? At the moment, I'm checking to see if something is outside of the start area with this
Code: Select all
util.distance({0,0}, resource.position) > resource.surface.get_starting_area_radius()
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: API request :)
Game has one starting position per surface I think. Everything else is handled in lua like in PvP scenario for example.FuryoftheStars wrote: ↑Wed Jan 12, 2022 3:53 pm Thanks. Haven't had a chance to try yet, but hopefully soon.
Question, regarding vanilla, does the game technically only have 1 start position? How does it handle competitive MP? At the moment, I'm checking to see if something is outside of the start area with thisBut that makes the assumption of only 1 start point at {0,0}.Code: Select all
util.distance({0,0}, resource.position) > resource.surface.get_starting_area_radius()
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: API request :)
I'm sorry it took me so long... but I've finally tested this and it worked. Thanks!
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics