Add a bunch more

This commit is contained in:
jordan4ibanez 2023-11-06 18:45:31 -05:00
parent e4dc0350b5
commit 8a038ccaae
8 changed files with 341 additions and 22 deletions

View File

@ -1,3 +1,8 @@
title = Forgotten Times
title = Forgotten Lands
author = jordan4ibanez
description = A prototype.
allowed_mapgens = v7
disallowed_mapgen_settings = seed
min_minetest_version = 5.7
max_minetest_version =

View File

@ -118,7 +118,7 @@ global record minetest
spawn_falling_node: function(Vec3): {boolean, ObjectRef} | boolean
find_nodes_with_meta: function(Vec3, Vec3): {Vec3}
get_meta: function(Vec3): MetaData
get_node_timer: function(Vec3): number
get_node_timer: function(Vec3): NodeTimerObject
add_entity: function(Vec3, string, string): ObjectRef | nil
add_item: function(Vec3, ItemStack | string): ObjectRef | nil
get_player_by_name: function(string): ObjectRef
@ -137,7 +137,7 @@ global record minetest
set_gen_notify: function(GenNotifyFlags, {number})
get_gen_notify: function(): {number}
get_decoration_id: function(string): number
get_mapgen_object: function(string): MapGenObjectDefinition
get_mapgen_object: function(string): GenNotifyObject
get_heat: function(Vec3): number
get_humidity: function(Vec3): number
get_biome_data: function(Vec3): BiomeDataDefinition | nil
@ -271,7 +271,7 @@ global record minetest
forceload_block: function(Vec3, boolean, number)
forceload_free_block: function(Vec3, boolean)
compare_block_status: function(Vec3, BlockStatusCondition): boolean | nil
request_insecure_environment: function(): InsecureEnvironment
request_insecure_environment: function(): any
global_exists: function(string): boolean
registered_items: {string : ItemDefinition}
@ -286,7 +286,7 @@ global record minetest
registered_aliases: {string : string}
registered_ores: {string : OreDefinition}
registered_biomes: {string : BiomeDefinition}
registered_decorations: {string : DecorationDefinition}
registered_decorations: {number : DecorationDefinition}
registered_schematics: {string : SchematicDefinition}
registered_chatcommands: {string : ChatCommandDefinition}
registered_privileges: {string : PrivilegeDefinition}
@ -348,7 +348,7 @@ global enum paramtype2
"colordegrotate"
end
global enum DrawType
global enum drawtype
"normal"
"airlike"
"liquid"
@ -625,7 +625,7 @@ global record ItemDefinition
end
global record NodeDefinition
drawtype: DrawType
drawtype: drawtype
visual_scale: number
tiles: {string}
overlay_tiles: {string}
@ -902,6 +902,7 @@ global enum DecorationFlags
end
global record DecorationDefinition
name: string
deco_type: DecorationType
place_on: string
sidelen: number
@ -914,7 +915,7 @@ global record DecorationDefinition
check_offset: number
num_spawn_by: number
flags: DecorationFlags
decoration: string
decoration: string | {string}
height: number
height_max: number
param2: number
@ -1165,9 +1166,8 @@ global record TreeDefinition
seed: number
end
global record MapGenObjectDefinition
end
global type GenNotifyObject = {string : {Vec3}}
global function VoxelManip(_pos1: Vec3, _pos2: Vec3): VoxelManipObject end
global record VoxelManipObject
@ -1225,10 +1225,6 @@ global record HumidityMapObject
end
global record GenNotifyObject
end
global function Raycast(_pos1: Vec3, _pos2: Vec3, _object: boolean, _liquids: boolean): RaycastObject end
global record RaycastObject
metamethod __call: function(RaycastObject): PointedThing | nil
@ -1239,7 +1235,7 @@ global record SecureRandomObject
next_bytes: function(SecureRandomObject, number): string
end
global function Settings(): MinetestSettingsObject end
global function Settings(_: string): MinetestSettingsObject end
global record MinetestSettingsObject
get: function(MinetestSettingsObject, string): any
get_bool: function(MinetestSettingsObject, string): boolean | nil
@ -1848,10 +1844,6 @@ global record ParticleSpawnerDefinition
texpool: ParticleSpawnerTexturePoolDefinition
end
global record InsecureEnvironment
end
global enum AreaStoreType
"LibSpatial"
end
@ -1963,6 +1955,15 @@ global record HitParamsReturn
time_from_last_punch: number
end
global record NodeTimerObject
set: function(NodeTimerObject, number, number)
start: function(NodeTimerObject, number)
stop: function(NodeTimerObject)
get_timeout: function(NodeTimerObject): number
get_elapsed: function(NodeTimerObject): number
is_started: function(NodeTimerObject): boolean
end
global record Translator
metamethod __call: function(Translator, ...: string): string
end

View File

@ -9,3 +9,73 @@ minetest.register_node(":stone", {
"default_stone.png",
},
})
minetest.register_node(":dirt", {
drawtype = "normal",
tiles = {
"default_dirt.png",
"default_dirt.png",
"default_dirt.png",
"default_dirt.png",
"default_dirt.png",
"default_dirt.png",
},
})
minetest.register_node(":grass", {
drawtype = "normal",
tiles = {
"default_grass.png",
"default_dirt.png",
"default_dirt.png^default_grass_side.png",
"default_dirt.png^default_grass_side.png",
"default_dirt.png^default_grass_side.png",
"default_dirt.png^default_grass_side.png",
},
})
minetest.register_node(":sand", {
drawtype = "normal",
tiles = {
"default_sand.png",
"default_sand.png",
"default_sand.png",
"default_sand.png",
"default_sand.png",
"default_sand.png",
},
})
minetest.register_node(":gravel", {
drawtype = "normal",
tiles = {
"default_gravel.png",
"default_gravel.png",
"default_gravel.png",
"default_gravel.png",
"default_gravel.png",
"default_gravel.png",
},
})
for i = 1, 5 do
local height = tostring(i)
minetest.register_node(":tall_grass_" .. height, {
drawtype = "plantlike",
walkable = false,
paramtype = "light",
paramtype2 = "degrotate",
tiles = {
"default_grass_" .. height .. ".png",
},
})
end
minetest.register_node(":apple_tree_creator", {
drawtype = "airlike",
walkable = false,
paramtype = "light",
on_timer = function(pos)
print(dump(pos))
end,
})

View File

@ -8,4 +8,74 @@ minetest.register_node(":stone", {
"default_stone.png",
"default_stone.png"
}
})
minetest.register_node(":dirt", {
drawtype = "normal",
tiles = {
"default_dirt.png",
"default_dirt.png",
"default_dirt.png",
"default_dirt.png",
"default_dirt.png",
"default_dirt.png"
}
})
minetest.register_node(":grass", {
drawtype = "normal",
tiles = {
"default_grass.png",
"default_dirt.png",
"default_dirt.png^default_grass_side.png",
"default_dirt.png^default_grass_side.png",
"default_dirt.png^default_grass_side.png",
"default_dirt.png^default_grass_side.png"
}
})
minetest.register_node(":sand", {
drawtype = "normal",
tiles = {
"default_sand.png",
"default_sand.png",
"default_sand.png",
"default_sand.png",
"default_sand.png",
"default_sand.png"
}
})
minetest.register_node(":gravel", {
drawtype = "normal",
tiles = {
"default_gravel.png",
"default_gravel.png",
"default_gravel.png",
"default_gravel.png",
"default_gravel.png",
"default_gravel.png"
}
})
for i = 1,5 do
local height: string = tostring(i)
minetest.register_node(":tall_grass_" .. height, {
drawtype = "plantlike",
walkable = false,
paramtype = "light",
paramtype2 = "degrotate",
tiles = {
"default_grass_" .. height .. ".png",
}
})
end
minetest.register_node(":apple_tree_creator", {
drawtype = "airlike",
walkable = false,
paramtype = "light",
on_timer = function(pos: Vec3)
print(dump(pos))
end
})

View File

@ -6,6 +6,6 @@ local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 th
do
local mod_directory = minetest.get_modpath("world") .. "/"
for _, k in ipairs(files_to_load) do
dofile(mod_directory .. k .. ".tl")
dofile(mod_directory .. k .. ".lua")
end
end

View File

@ -6,6 +6,6 @@ local files_to_load = {
do
local mod_directory = minetest.get_modpath("world") .. "/"
for _,k in ipairs(files_to_load) do
dofile(mod_directory .. k .. ".tl")
dofile(mod_directory .. k .. ".lua")
end
end

View File

@ -1 +1,87 @@
local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local table = _tl_compat and _tl_compat.table or table
minetest.register_alias("mapgen_stone", "stone")
minetest.register_alias("mapgen_dirt", "dirt")
minetest.register_alias("mapgen_dirt_with_grass", "grass")
minetest.register_alias("mapgen_sand", "sand")
minetest.register_alias("mapgen_gravel", "gravel")
minetest.register_biome({
name = "Forgotten Fields",
node_top = "grass",
depth_top = 1,
node_filler = "dirt",
depth_filler = 6,
node_stone = "stone",
})
do
local grass = {}
for i = 1, 5 do
local height = tostring(i)
table.insert(grass, "tall_grass_" .. height)
end
minetest.register_decoration({
deco_type = "simple",
place_on = "grass",
biomes = { "Forgotten Fields" },
decoration = grass,
param2 = 0,
param2_max = 239,
fill_ratio = 0.98,
})
end
do
minetest.register_decoration({
name = "apple_tree_creator",
deco_type = "simple",
place_on = "grass",
biomes = { "Forgotten Fields" },
decoration = "apple_tree_creator",
fill_ratio = 0.01,
})
local decoration_id = minetest.get_decoration_id("apple_tree_creator")
print(decoration_id)
minetest.set_gen_notify("decoration", { decoration_id })
local apple_tree = {
axiom = "FFFFFFF",
trunk = "sand",
leaves = "gravel",
angle = 30,
iterations = 1,
random_level = 0,
trunk_type = "single",
fruit_chance = 10,
fruit = "stone",
}
local id = minetest.get_content_id("apple_tree_creator")
minetest.register_on_generated(function(min, max)
local mapgen = minetest.get_mapgen_object("gennotify")
local iteration = mapgen["decoration#1"]
if (iteration == nil) then return end
for _, v in ipairs(iteration) do
print(dump(v))
end
end)
end

View File

@ -0,0 +1,87 @@
-- Solids
minetest.register_alias("mapgen_stone", "stone")
minetest.register_alias("mapgen_dirt", "dirt")
minetest.register_alias("mapgen_dirt_with_grass", "grass")
-- Falling
minetest.register_alias("mapgen_sand", "sand")
minetest.register_alias("mapgen_gravel", "gravel")
-- Liquids
-- Biomes
minetest.register_biome({
name = "Forgotten Fields",
node_top = "grass",
depth_top = 1,
node_filler = "dirt",
depth_filler = 6,
node_stone = "stone"
})
do
local grass = {}
for i = 1,5 do
local height = tostring(i)
table.insert(grass, "tall_grass_" .. height)
end
minetest.register_decoration({
deco_type = "simple",
place_on = "grass",
biomes = {"Forgotten Fields"},
decoration = grass,
param2 = 0,
param2_max = 239,
fill_ratio = 0.98
})
end
do
minetest.register_decoration({
name = "apple_tree_creator",
deco_type = "simple",
place_on = "grass",
biomes = {"Forgotten Fields"},
decoration = "apple_tree_creator",
fill_ratio = 0.01
})
local decoration_id: number = minetest.get_decoration_id("apple_tree_creator")
print(decoration_id)
minetest.set_gen_notify("decoration", {decoration_id})
local apple_tree: TreeDefinition = {
axiom = "FFFFFFF",
trunk = "sand",
leaves = "gravel",
angle = 30,
iterations = 1,
random_level = 0,
trunk_type = "single",
fruit_chance = 10,
fruit = "stone"
}
local id: number = minetest.get_content_id("apple_tree_creator")
minetest.register_on_generated(function()
local mapgen: GenNotifyObject = minetest.get_mapgen_object("gennotify")
local iteration = mapgen["decoration#1"]
if (iteration == nil) then return end
for _,pos in ipairs(iteration) do
minetest.get_node_timer(pos):start(math.random() * 10)
end
end)
-- minetest.register_lbm({
-- label = "apple_tree_creator",
-- name = ":apple_tree_creator",
-- nodenames = {"apple_tree_creator"},
-- run_at_every_load = true,
-- action = function(pos: Vec3)
-- minetest.remove_node(pos)
-- minetest.spawn_tree(pos, apple_tree)
-- end
-- })
end