Implementing a new ore (2024)

MrSmoothieHuman wrote:

Sun Aug 06, 2023 6:49 pm

if you really dont mind me asking, since i dont want to go offtopic from my original point, but how do you implement autoplace? i copied over the uranium ore code (without realising why the code was different from the normal 4 ores), but it seems to all work after name-changes and things.
However, i (think) i have succesfully implemented autoplace into my code […]
but of course, i want to be sure i have everything down correctly. Sorry if its too offtpoic, but thank you for helping so far!

So far, I have no personal experience in modding resources. But you are calling the function resource_autoplace_settings defined in data/core/lualib/resource-autoplace.lua, which is preceded by this comment:

Code: Select all

--- Creates and returns an AutoplaceSpecification that will generate spot-based ore patches.-- Required parameters:-- - name - name for the type, used as the default autoplace control name and patch set name-- (each of which can be overridden separately)-- - base_density - amount of stuff, on average, to be placed per tile-- Optional parameters:-- - patch_set_name - name of the patch set; patches sets of the same name and seed1 will overlap; default: name-- - autoplace_control_name - name of the corresponding autoplace control; default: name-- - random_probability - probability of placement at any given tile within a patch; default: 1-- - base_spots_per_km2 - number of patches per square kilometer near the starting area-- - has_starting_area_placement - true|false|nil - yes, no, and there is no special starting area, respectively-- - seed1 - random seed to use when generating patch positions; default: 100-- More obscure parameters can be read about in the inline comments.

According to your screenshot, the required parameter base_density is missing, so you should fix that. Comparing the code of the function with your screenshot, "name" seems to be the only valid parameter you've used. Also, the description of AutoplaceSpecification doesn't contain anything about "type", "category", "richness", and "can_be_disabled". There are some parameters you didn't include (e.g. "order" and "control"), but it seems the function will provide default values to fall back on.

Regarding "richness", this is not supposed to be a Boolean value. Instead, there are "richness_base", "richness_multiplier", and "richness_multiplier_distance_bonus" which will be used to calculate richness.

In Pyanodons Raw Ores, I've found two different ways to set "autoplace". This one is used for pure ores (e.g. in prototypes/ores/aluminium.lua):

Code: Select all

 autoplace = resource_autoplace.resource_autoplace_settings { name = "ore-aluminium", order = "b", base_density = 10, base_spots_per_km2 = 1.25, has_starting_area_placement = true, random_spot_size_minimum = 2, random_spot_size_maximum = 4, regular_rq_factor_multiplier = 1, starting_rq_factor_multiplier = 2, candidate_spot_count = 20 },

This one is used for a combination of a particular ore and rock, which seems to not use resource_autoplace.resource_autoplace_settings (e.g. in prototypes/ores/aluminium-rock.lua):

Code: Select all

 autoplace = { name = "aluminium-rock", order = "b-aluminium-rock", -- We return the chance of spawning on any given tile here probability_expression = noise.define_noise_function( function(x, y, tile, map) -- This is the user's map setting for the frequency of this ore local frequency_multiplier = noise.var("control-setting:aluminium-rock:frequency:multiplier") -- 0% chance of spawning in starting area (tier == 0) -- Using this is equivalent to has_starting_area_placement = false local tier = noise.clamp(noise.var("tier"), 0, 1) -- 1 in 64 chunks (each chunk is 64x64 tiles) local desired_frequency = 1 / (64 * 64^2) -- Our final chance, likely a very, very small decimal return tier * desired_frequency * frequency_multiplier end), -- We return the richness here, which is just the quantity the resource tile yields richness_expression = noise.define_noise_function( function(x, y, tile, map) -- This is the user's map setting for richness of this ore -- We ignore size here because we're always a single tile resource local richness_multiplier = noise.var("control-setting:aluminium-rock:richness:multiplier") -- This is the distance from the starting position, which is how vanilla scales ore yield local distance_value = noise.var("distance") -- This is our multiplier for the above, determining the yield gains over distance local scalar = 2^16 -- Add it all together or what is likely a pretty big number return distance_value * scalar * richness_multiplier end) },

I hope these examples are useful! Otherwise, you should open a separate thread regarding autoplacing of resources. This would increase your chances that some real experts in this field may help you. Implementing a new ore (1)

A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Implementing a new ore (2024)
Top Articles
Complete 1 - 99 OSRS Herblore Guide (FAST/CHEAP) - OSRS Guide
Zillow Lawrence County Al
Netronline Taxes
Frases para un bendecido domingo: llena tu día con palabras de gratitud y esperanza - Blogfrases
The Blackening Showtimes Near Century Aurora And Xd
Pixel Speedrun Unblocked 76
Po Box 7250 Sioux Falls Sd
Urist Mcenforcer
Breaded Mushrooms
East Cocalico Police Department
Botanist Workbench Rs3
How to change your Android phone's default Google account
Gabrielle Abbate Obituary
Gameday Red Sox
J Prince Steps Over Takeoff
Apnetv.con
Jesus Revolution Showtimes Near Chisholm Trail 8
Flower Mound Clavicle Trauma
Baywatch 2017 123Movies
Diamond Piers Menards
Der Megatrend Urbanisierung
Uktulut Pier Ritual Site
Equibase | International Results
Craigslist Free Stuff Merced Ca
Scout Shop Massapequa
O'Reilly Auto Parts - Mathis, TX - Nextdoor
Panolian Batesville Ms Obituaries 2022
Drug Test 35765N
Minnick Funeral Home West Point Nebraska
Yugen Manga Jinx Cap 19
Bill Remini Obituary
Airtable Concatenate
2021 MTV Video Music Awards: See the Complete List of Nominees - E! Online
HP PARTSURFER - spare part search portal
Our Leadership
N.J. Hogenkamp Sons Funeral Home | Saint Henry, Ohio
The value of R in SI units is _____?
Luciipurrrr_
Hair Love Salon Bradley Beach
Ludvigsen Mortuary Fremont Nebraska
Stanford Medicine scientists pinpoint COVID-19 virus’s entry and exit ports inside our noses
Timberwolves Point Guard History
O'reilly's El Dorado Kansas
Cocorahs South Dakota
The Horn Of Plenty Figgerits
Samsung 9C8
10 Best Tips To Implement Successful App Store Optimization in 2024
Makes A Successful Catch Maybe Crossword Clue
Diccionario De Los Sueños Misabueso
Publix Store 840
Compete My Workforce
Arre St Wv Srj
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5917

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.