]> git.lizzy.rs Git - Crafter.git/commitdiff
Add in better nether generation, effects, and lava
authoroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 18 Apr 2020 11:23:39 +0000 (07:23 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 18 Apr 2020 11:23:39 +0000 (07:23 -0400)
README.md
mods/main/nodes.lua
mods/main/textures/lavaFlow.png [deleted file]
mods/main/textures/lavaSource.png [deleted file]
mods/main/textures/lava_flow.png [new file with mode: 0644]
mods/main/textures/lava_source.png [new file with mode: 0644]
mods/nether/init.lua
mods/weather/sounds/untitled.ogg [new file with mode: 0644]
mods/weather/textures/ichor_1.png [new file with mode: 0644]
mods/weather/textures/ichor_2.png [new file with mode: 0644]

index e4833d3d35bd68a888bbf65fdfd4d83a5edbb8b3..1f0216eaa03201257f3c0a91728715236fc3c4bd 100644 (file)
--- a/README.md
+++ b/README.md
 
 
 ### HALLOWEEN!
+- lava acts like water in the nether but lava in the other worlds
 - pumpkins
 - Jack O'Lanterns
 - corn and corn stalks
index 24eb062dd149d74ce83a8e5bb0035492320ed450..61ee3d1e48628e7ef8b6fbec2addf2b93a691796 100644 (file)
@@ -324,35 +324,33 @@ minetest.register_node("main:waterflow", {
        --sounds = default.node_sound_water_defaults(),
 })
 
---[[
-
-minetest.register_node("default:lava_source", {
-       description = S("Lava Source"),
+minetest.register_node("main:lava", {
+       description = "Lava",
        drawtype = "liquid",
        tiles = {
                {
-                       name = "default_lava_source_animated.png",
+                       name = "lava_source.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 3.0,
+                               length = 2.0,
                        },
                },
                {
-                       name = "default_lava_source_animated.png",
+                       name = "lava_source.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
                                aspect_w = 16,
                                aspect_h = 16,
-                               length = 3.0,
+                               length = 2.0,
                        },
                },
        },
        paramtype = "light",
-       light_source = default.LIGHT_MAX - 1,
+       light_source = 13,
        walkable = false,
        pointable = false,
        diggable = false,
@@ -361,8 +359,8 @@ minetest.register_node("default:lava_source", {
        drop = "",
        drowning = 1,
        liquidtype = "source",
-       liquid_alternative_flowing = "default:lava_flowing",
-       liquid_alternative_source = "default:lava_source",
+       liquid_alternative_flowing = "main:lavaflow",
+       liquid_alternative_source = "main:lava",
        liquid_viscosity = 7,
        liquid_renewable = false,
        damage_per_second = 4 * 2,
@@ -370,13 +368,13 @@ minetest.register_node("default:lava_source", {
        groups = {lava = 3, liquid = 2, igniter = 1},
 })
 
-minetest.register_node("default:lava_flowing", {
-       description = S("Flowing Lava"),
+minetest.register_node("main:lavaflow", {
+       description = "Flowing Lava",
        drawtype = "flowingliquid",
-       tiles = {"default_lava.png"},
+       tiles = {"lava_flow.png"},
        special_tiles = {
                {
-                       name = "default_lava_flowing_animated.png",
+                       name = "lava_flow.png",
                        backface_culling = false,
                        animation = {
                                type = "vertical_frames",
@@ -386,7 +384,7 @@ minetest.register_node("default:lava_flowing", {
                        },
                },
                {
-                       name = "default_lava_flowing_animated.png",
+                       name = "lava_flow.png",
                        backface_culling = true,
                        animation = {
                                type = "vertical_frames",
@@ -398,7 +396,7 @@ minetest.register_node("default:lava_flowing", {
        },
        paramtype = "light",
        paramtype2 = "flowingliquid",
-       light_source = default.LIGHT_MAX - 1,
+       light_source = 13,
        walkable = false,
        pointable = false,
        diggable = false,
@@ -407,18 +405,15 @@ minetest.register_node("default:lava_flowing", {
        drop = "",
        drowning = 1,
        liquidtype = "flowing",
-       liquid_alternative_flowing = "default:lava_flowing",
-       liquid_alternative_source = "default:lava_source",
+       liquid_alternative_flowing = "main:lavaflow",
+       liquid_alternative_source = "main:lava",
        liquid_viscosity = 7,
        liquid_renewable = false,
-       damage_per_second = 4 * 2,
+       damage_per_second = 2,
        post_effect_color = {a = 191, r = 255, g = 64, b = 0},
-       groups = {lava = 3, liquid = 2, igniter = 1,
-               not_in_creative_inventory = 1},
+       groups = {lava = 3, liquid = 2, igniter = 1},
 })
 
-]]--
-
 minetest.register_node("main:ladder", {
        description = "Ladder",
        drawtype = "signlike",
diff --git a/mods/main/textures/lavaFlow.png b/mods/main/textures/lavaFlow.png
deleted file mode 100644 (file)
index cc40b45..0000000
Binary files a/mods/main/textures/lavaFlow.png and /dev/null differ
diff --git a/mods/main/textures/lavaSource.png b/mods/main/textures/lavaSource.png
deleted file mode 100644 (file)
index a01dd2d..0000000
Binary files a/mods/main/textures/lavaSource.png and /dev/null differ
diff --git a/mods/main/textures/lava_flow.png b/mods/main/textures/lava_flow.png
new file mode 100644 (file)
index 0000000..decf332
Binary files /dev/null and b/mods/main/textures/lava_flow.png differ
diff --git a/mods/main/textures/lava_source.png b/mods/main/textures/lava_source.png
new file mode 100644 (file)
index 0000000..1bfec72
Binary files /dev/null and b/mods/main/textures/lava_source.png differ
index cfc035a9b89b8073bdb930825a0706739db68a31..3436566a84eb27e80235ece958a98fba541af7fb 100644 (file)
@@ -1,38 +1,26 @@
 minetest.register_biome({
-       name = "Hell",
-       --node_top = "air",
-       --depth_top = 1,
-       --node_filler = "air",
-       --depth_filler = 1,
-       --node_riverbed = "air",
-       --depth_riverbed = 2,
-       node_stone = "nether:netherrack",
-       --node_water = "air",
-       --node_dungeon = "default:cobble",
-       --node_dungeon_alt = "default:mossycobble",
-       --node_dungeon_stair = "stairs:stair_cobble",
+       name = "Nether",
+       node_top = "air",
+       depth_top = 0,
+       node_filler = "air",
+       depth_filler = 0,
+       node_riverbed = "air",
+       depth_riverbed= 0,
+       node_stone = "air",
+       node_water = "air",
+       node_dungeon = "air",
+       node_dungeon_alt = "air",
+       node_dungeon_stair = "air",
        vertical_blend = 0,
-       y_max = -10035,
+       y_max = -10000,
        y_min = -20000,
-       heat_point = 50,
-       humidity_point = 50,
-})
-
-
-minetest.register_ore({
-       ore_type         = "scatter",
-       ore             = "air",
-       wherein   = "nether:netherrack",
-       clust_scarcity = 7 * 7 * 7,
-       clust_num_ores = 256,
-       clust_size     = 5,
-       y_max       = -10035,
-       y_min       = -20000,
+       heat_point = -100,
+       humidity_point = -100,
 })
 
-
+--[[
 minetest.register_biome({
-       name = "Boundary of Hell",
+       name = "Boundary of Nether",
        node_top = "nether:bedrock",
        depth_top = 1,
        node_filler = "nether:bedrock",
@@ -45,13 +33,13 @@ minetest.register_biome({
        node_dungeon = "nether:bedrock",
        node_dungeon_alt = "nether:bedrock",
        node_dungeon_stair = "nether:bedrock",
-       vertical_blend = 0,
+       vertical_blend = 1,
        y_max = -10033,
        y_min = -10034,
        heat_point = -100,
        humidity_point = -100,
 })
-
+]]--
 minetest.register_node("nether:bedrock", {
     description = "Bedrock",
     tiles = {"bedrock.png"},
@@ -80,3 +68,169 @@ minetest.register_node("nether:obsidian", {
     is_ground_content = false,
     --light_source = 7,
 })
+
+
+
+
+
+
+
+
+
+--this is from https://github.com/paramat/lvm_example/blob/master/init.lua
+--hi paramat :D
+
+-- Set the 3D noise parameters for the terrain.
+local perlin= minetest.get_mapgen_params()
+local np_terrain = {
+       offset = 0,
+       scale = 1,
+       spread = {x = 384, y = 192, z = 384},
+       seed = 5900033, --perlin.seed
+       octaves = 5,
+       persist = 0.63,
+       lacunarity = 2.0,
+       --flags = ""
+}
+
+
+-- Set singlenode mapgen (air nodes only).
+-- Disable the engine lighting calculation since that will be done for a
+-- mapchunk of air nodes and will be incorrect after we place nodes.
+
+--minetest.set_mapgen_params({mgname = "singlenode", flags = "nolight"})
+
+
+-- Get the content IDs for the nodes used.
+
+local c_sandstone = minetest.get_content_id("nether:netherrack")
+local c_bedrock = minetest.get_content_id("nether:bedrock")
+local c_air = minetest.get_content_id("air")
+local c_lava = minetest.get_content_id("main:lava")
+
+
+-- Initialize noise object to nil. It will be created once only during the
+-- generation of the first mapchunk, to minimise memory use.
+
+local nobj_terrain = nil
+
+
+-- Localise noise buffer table outside the loop, to be re-used for all
+-- mapchunks, therefore minimising memory use.
+
+local nvals_terrain = {}
+
+
+-- Localise data buffer table outside the loop, to be re-used for all
+-- mapchunks, therefore minimising memory use.
+
+local data = {}
+
+
+-- On generated function.
+
+-- 'minp' and 'maxp' are the minimum and maximum positions of the mapchunk that
+-- define the 3D volume.
+minetest.register_on_generated(function(minp, maxp, seed)
+       --nether starts at -10033 y
+       if maxp.y > -10033 then
+               return
+       end
+       -- Start time of mapchunk generation.
+       --local t0 = os.clock()
+       
+       -- Noise stuff.
+
+       -- Side length of mapchunk.
+       local sidelen = maxp.x - minp.x + 1
+       -- Required dimensions of the 3D noise perlin map.
+       local permapdims3d = {x = sidelen, y = sidelen, z = sidelen}
+       -- Create the perlin map noise object once only, during the generation of
+       -- the first mapchunk when 'nobj_terrain' is 'nil'.
+       nobj_terrain = minetest.get_perlin_map(np_terrain, permapdims3d) --nobj_terrain or 
+       -- Create a flat array of noise values from the perlin map, with the
+       -- minimum point being 'minp'.
+       -- Set the buffer parameter to use and reuse 'nvals_terrain' for this.
+       nobj_terrain:get3dMap_flat(minp, nvals_terrain)
+
+       -- Voxelmanip stuff.
+
+       -- Load the voxelmanip with the result of engine mapgen. Since 'singlenode'
+       -- mapgen is used this will be a mapchunk of air nodes.
+       local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
+       -- 'area' is used later to get the voxelmanip indexes for positions.
+       local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
+       -- Get the content ID data from the voxelmanip in the form of a flat array.
+       -- Set the buffer parameter to use and reuse 'data' for this.
+       vm:get_data(data)
+
+       -- Generation loop.
+
+       -- Noise index for the flat array of noise values.
+       local ni = 1
+       -- Process the content IDs in 'data'.
+       -- The most useful order is a ZYX loop because:
+       -- 1. This matches the order of the 3D noise flat array.
+       -- 2. This allows a simple +1 incrementing of the voxelmanip index along x
+       -- rows.
+       -- rows.
+       for z = minp.z, maxp.z do
+       for y = minp.y, maxp.y do
+               -- Voxelmanip index for the flat array of content IDs.
+               -- Initialise to first node in this x row.
+               local vi = area:index(minp.x, y, z)
+               for x = minp.x, maxp.x do
+                       -- Consider a 'solidness' value for each node,
+                       -- let's call it 'density', where
+                       -- density = density noise + density gradient.
+                       local density_noise = nvals_terrain[ni]
+                       -- Density gradient is a value that is 0 at water level (y = 1)
+                       -- and falls in value with increasing y. This is necessary to
+                       -- create a 'world surface' with only solid nodes deep underground
+                       -- and only air high above water level.
+                       -- Here '128' determines the typical maximum height of the terrain.
+                       local density_gradient = (1 - y) / 128
+                       
+                       --print(density_noise, density_gradient)
+                       -- Place solid nodes when 'density' > 0.
+                       --if density_noise + density_gradient > 0 then
+                       if density_noise > 0  and y ~= -10033 then
+                               data[vi] = c_sandstone
+                       -- Otherwise if at or below water level place water.
+                       elseif y == -10033 then
+                               data[vi] = c_bedrock
+                       --elseif y <= 1 then
+                       --      data[vi] = c_water
+                       elseif y > -15000 then
+                               data[vi] = c_air
+                       else
+                               data[vi] = c_lava
+                       end
+
+                       -- Increment noise index.
+                       ni = ni + 1
+                       -- Increment voxelmanip index along x row.
+                       -- The voxelmanip index increases by 1 when
+                       -- moving by 1 node in the +x direction.
+                       vi = vi + 1
+               end
+       end
+       end
+
+       -- After processing, write content ID data back to the voxelmanip.
+       vm:set_data(data)
+       -- Calculate lighting for what has been created.
+       --vm:calc_lighting()
+       
+       vm:set_lighting({day=7,night=7}, minp, maxp)
+       
+       -- Write what has been created to the world.
+       vm:write_to_map()
+       -- Liquid nodes were placed so set them flowing.
+       --vm:update_liquids()
+
+       -- Print generation time of this mapchunk.
+       --local chugent = math.ceil((os.clock() - t0) * 1000)
+       --print ("[lvm_example] Mapchunk generation time " .. chugent .. " ms")
+end)
+
diff --git a/mods/weather/sounds/untitled.ogg b/mods/weather/sounds/untitled.ogg
new file mode 100644 (file)
index 0000000..2320d71
Binary files /dev/null and b/mods/weather/sounds/untitled.ogg differ
diff --git a/mods/weather/textures/ichor_1.png b/mods/weather/textures/ichor_1.png
new file mode 100644 (file)
index 0000000..7554cf9
Binary files /dev/null and b/mods/weather/textures/ichor_1.png differ
diff --git a/mods/weather/textures/ichor_2.png b/mods/weather/textures/ichor_2.png
new file mode 100644 (file)
index 0000000..3b31df3
Binary files /dev/null and b/mods/weather/textures/ichor_2.png differ