Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local settings = settings["startup"]
- local function index_to_letter(index, starting_at)
- return string.char(string.byte(starting_at or "a", 1) - 1 + index)
- end
- local function AddLootToEntity(entityType, entityName, itemName, probability, countMin, countMax)
- if data.raw[entityType] ~= nil then
- if data.raw[entityType][entityName] ~= nil then
- if data.raw[entityType][entityName].loot == nil then
- data.raw[entityType][entityName].loot = {}
- end
- table.insert(data.raw[entityType][entityName].loot, {item = itemName, probability = probability, count_min = countMin, count_max = countMax})
- end
- end
- end
- local function generate_localized_name(basestring, name)
- if string.sub(name, 1, 5) == "tree-" then
- --Standard tree-xx and tree-xx-color naming
- local number = string.sub(name, 6, 7)
- local color = string.gsub(string.sub(name, 9), "^%l", string.upper)
- if color ~= "" then
- color = color .. " "
- end
- return {basestring, color, "Tree", number}
- elseif string.sub(name, 1, 5) == "dry-t" then
- --Dry Tree
- return {basestring, "Dry ", "Tree", ""}
- elseif string.sub(name, 1, 5) == "dry-h" then
- --Dry Hairy Tree
- return {basestring, "Dry Hairy ", "Tree", ""}
- elseif string.sub(name, -5) == "coral" then
- --Base game coral
- local color = string.gsub(string.sub(name, 1, -7), "^%l", string.upper)
- if color ~= "" then
- color = color .. " "
- end
- return {basestring, color, "Coral", ""}
- elseif string.sub(name, 1, 6) == "coral-" then
- --Coral from Alien Biomes mod
- local number = string.sub(name, -2)
- local color = string.gsub(string.sub(name, 7, -4), "^%l", string.upper)
- if color ~= "" then
- color = color .. " "
- end
- return {basestring, color, "Coral", number}
- end
- return {basestring, name, "", ""}
- end
- --[[local function AddResToEntity(entityType, entityName, itemName, amount)
- if data.raw[entityType] ~= nil then
- if data.raw[entityType][entityName] ~= nil then
- if data.raw[entityType][entityName].minable.results == nil then
- data.raw[entityType][entityName].minable.results = {{data.raw[entityType][entityName].minable.result, data.raw[entityType][entityName].minable.count}}
- data.raw[entityType][entityName].minable.result=nil
- data.raw[entityType][entityName].minable.count=nil
- end
- table.insert(data.raw[entityType][entityName].minable.results, {itemName, amount})
- end
- end
- end]]
- for i, tree_data in pairs(data.raw["tree"]) do
- --local type_number = string.format("%02d", tree_data.type)
- --local type_name = "tree-" .. type_number
- local name = i
- if not string.match(name, "termite") then -- fix
- if string.find(name, "dead-") == nil and string.find(name, "planted-sapling") == nil then
- local saplingname = generate_localized_name("item-name.sapling", name)
- local seedsname = generate_localized_name("item-name.seeds", name)
- data:extend(
- {--[[
- {
- type = "tree",
- name = name,
- icon = "__base__/graphics/icons/" .. type_name .. ".png",
- flags = {"placeable-neutral", "placeable-off-grid", "breaths-air"},
- minable =
- {
- mining_particle = "wooden-particle",
- mining_time = 2,
- results = {{"raw-wood", 4},{name.."-seeds", 2}}
- },
- corpse = type_name .. "-stump",
- remains_when_mined = type_name .. "-stump",
- emissions_per_tick = -0.0005,
- max_health = 50,
- collision_box = {{-0.4, -0.4}, {0.4, 0.4}},
- selection_box = {{-0.9, -2.2}, {0.9, 0.6}},
- drawing_box = tree_data.drawing_box,
- subgroup = "trees",
- order = "a[tree]-a[regular]-" .. order,
- vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
- autoplace = autoplace_settings(tree_data.autoplace_peaks, tree_data.autoplace_extra),
- variations = tree_variations,
- colors = tree_data.colors
- },]]
- {
- type = "item",
- name = name.."-sapling",
- localised_name = saplingname,
- icon = tree_data.icon,
- flags = {"goes-to-quickbar"},
- subgroup = "trees",
- order = "a-c["..name.."]",
- place_result = name,
- stack_size = 100
- },
- {
- type = "item",
- name = name.."-seeds",
- localised_name = seedsname,
- icon = "__base__/graphics/icons/root-a.png",
- flags = {"goes-to-main-inventory"},
- subgroup = "trees",
- order = "a-c["..name.."]",
- fuel_category = "chemical",
- fuel_value = "0.8MJ",
- fuel_acceleration_multiplier = 0.8,
- fuel_top_speed_multiplier = 0.8,
- stack_size = 500
- },
- {
- type = "recipe",
- name = name.."-sapling",
- localised_name = saplingname,
- category = "arborium",
- enabled = true,
- hidden = true,
- energy_required = settings["arborium-tree-time"].value or 30,
- ingredients =
- {
- {name.."-seeds", 1}
- },
- result=name.."-sapling",
- icon = tree_data.icon,
- subgroup = "trees",
- --order = "a[oil-processing]-a[basic-oil-processing]"
- },
- {
- type = "recipe",
- name = "mulch-" .. name,
- localised_name = generate_localized_name("recipe-name.mulching", name),
- enabled = true,
- hidden = true,
- category = "mulchening",
- energy_required = settings["arborium-mulch-time"].value or 10,
- ingredients =
- {
- {name.."-sapling", 1}
- },
- results=
- {
- {type = "item", name = "raw-wood", amount_min = settings['arborium-min-wood'].value or 3, amount_max = settings['arborium-max-wood'].value or 4},
- {type = "item", name = name.."-seeds", amount_min = settings['arborium-min-seed'].value or 1, amount_max = settings['arborium-max-seed'].value or 3}
- },
- main_product="raw-wood",
- subgroup = "trees",
- --order = "a[oil-processing]-a[basic-oil-processing]"
- },
- --[[
- {
- type = "recipe",
- name = name.."-seeds-to-wood",
- category = "smelting",
- enabled = true,
- hidden = true,
- energy_required = 2,
- ingredients =
- {
- {name.."-seeds", 4}
- },
- result = "wood"
- }
- ]]
- })
- AddLootToEntity("tree",name,name.."-seeds",.5,1,settings['arborium-tree-seed'].value or 2)
- if tree_data.minable.results then
- table.insert(data.raw["tree"][i].minable.results, {name.."-seeds", settings['arborium-tree-seed'].value or 2})
- else
- if data.raw.tree[i].minable then
- if data.raw.tree[i].minable.result then
- data.raw.tree[i].minable=
- {
- mining_particle = "wooden-particle",
- mining_time = data.raw.tree[i].minable.mining_time or 2,
- results = {{data.raw.tree[i].minable.result, data.raw.tree[i].minable.count},{name.."-seeds", settings['arborium-tree-seed'].value or 2}}
- }
- else
- data.raw.tree[i].minable=
- {
- mining_particle = "wooden-particle",
- mining_time = data.raw.tree[i].minable.mining_time or 2,
- results = {{name.."-seeds", settings['arborium-tree-seed'].value or 2}}
- }
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment