bztungsten2/tungsten-ore.lua
2025-10-19 15:42:37 +02:00

87 lines
3.1 KiB
Lua

local resource_autoplace = require('resource-autoplace');
local item_sounds = require('__base__.prototypes.item_sounds')
local util = require("__bztungsten__.data-util");
data.raw.planet.nauvis.map_gen_settings.autoplace_controls["tungsten-ore"] = {}
data.raw.planet.nauvis.map_gen_settings.autoplace_settings.entity.settings["tungsten-ore"] = {}
resource_autoplace.initialize_patch_set("tungsten-ore", true)
data:extend({
{
type = "autoplace-control",
category = "resource",
name = "tungsten-ore",
richness = true,
order = "b-e"
},
{
type = "resource",
icon_size = 64, icon_mipmaps = 3,
name = "tungsten-ore",
icon = "__bztungsten__/graphics/icons/tungsten-ore.png",
flags = {"placeable-neutral"},
order="a-b-a",
map_color = {r=0.90, g=0.90, b=0.80},
tree_removal_probability = 0.7,
tree_removal_max_distance = 32 * 32,
minable =
{
hardness = 1,
mining_particle = "tungsten-ore-particle",
mining_time = 2,
fluid_amount = util.me.fluid_amount(),
required_fluid= util.me.fluid(),
result = "tungsten-ore"
},
collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
autoplace = resource_autoplace.resource_autoplace_settings{
name = "tungsten-ore",
order = "b-z",
base_density = 4,
has_starting_area_placement = util.me.starting_patch() and true,
regular_rq_factor_multiplier = 1.2,
starting_rq_factor_multiplier = 1.0,
},
stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80},
stages =
{
sheet =
{
filename = "__bztungsten__/graphics/entity/ores/tungsten-ore.png",
priority = "extra-high",
size = 128,
frame_count = 8,
variation_count = 8,
scale = 0.5,
}
},
},
{
type = "item",
name = "tungsten-ore",
icon_size = 64, icon_mipmaps = 3,
icon = "__bztungsten__/graphics/icons/tungsten-ore.png",
pictures = {
{filename="__bztungsten__/graphics/icons/tungsten-ore.png", size=64, scale=0.5},
{filename="__bztungsten__/graphics/icons/tungsten-ore-2.png", size=64, scale=0.5},
{filename="__bztungsten__/graphics/icons/tungsten-ore-3.png", size=64, scale=0.5},
{filename="__bztungsten__/graphics/icons/tungsten-ore-4.png", size=64, scale=0.5},
},
subgroup = "raw-resource",
order = "t-c-a",
stack_size = 50,
weight = 20 * kg,
inventory_move_sound = item_sounds.resource_inventory_move,
pick_sound = item_sounds.resource_inventory_pickup,
drop_sound = item_sounds.resource_inventory_move
},
})
-- Wolframite becomes 20% richer past 1000 tiles, 60% richer past 10000 tiles. Very close to start, it's 25% richness
local richness = data.raw.resource["tungsten-ore"].autoplace.richness_expression
data.raw.resource["tungsten-ore"].autoplace.richness_expression = richness ..
"* if(distance_from_nearest_point(x, y, starting_positions) < 100, 0.25, if(distance_from_nearest_point(x, y, starting_positions) < 1000, 1, if(distance_from_nearest_point(x, y, starting_positions) < 100, 1.2, 1.6)))"