From 6c255b5482239cc1b8bc66ca0ed553d3ea54ff49 Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Sun, 26 Nov 2023 16:54:10 -0500 Subject: [PATCH] Namespacing (#2) * move media mod into proper game textures folder * namespace the easy mods * add .luacheckrc file so my editor stops warning me * toss schematics mod since unused and better alternatives exist on cdb * namespace mapgen mod * fix some luacheck warnings * licensing * namespace track mod * namespace trees mod * add luacheck action * fix luacheck warnings in driftgame --- .github/workflows/luacheck.yml | 10 ++ .luacheckrc | 25 ++++ mods/{gui => dg_gui}/README.txt | 0 mods/{gui => dg_gui}/init.lua | 0 mods/{gui => dg_gui}/license.txt | 0 mods/{gui => dg_gui}/textures/bubble.png | Bin mods/{gui => dg_gui}/textures/gui_formbg.png | Bin mods/{gui => dg_gui}/textures/heart.png | Bin mods/{hand => dg_hand}/README.txt | 0 mods/{hand => dg_hand}/init.lua | 0 mods/{hand => dg_hand}/license.txt | 0 mods/{hand => dg_hand}/textures/wieldhand.png | Bin mods/{light => dg_light}/README.txt | 0 mods/dg_light/init.lua | 20 +++ mods/{light => dg_light}/license.txt | 2 +- .../textures/dg_light_light.png} | Bin mods/{mapgen => dg_mapgen}/README.txt | 0 mods/{mapgen => dg_mapgen}/init.lua | 120 +++++++++--------- mods/{track => dg_mapgen}/license.txt | 2 +- .../textures/dg_mapgen_dirt.png} | Bin .../textures/dg_mapgen_grass.png} | Bin .../textures/dg_mapgen_magma.png} | Bin .../textures/dg_mapgen_sand.png} | Bin .../textures/dg_mapgen_stone.png} | Bin .../textures/dg_mapgen_stone_block.png} | Bin .../dg_mapgen_stone_block_divided.png} | Bin .../textures/dg_mapgen_water.png} | Bin mods/{track => dg_track}/README.txt | 0 mods/{track => dg_track}/init.lua | 23 ++-- mods/{mapgen => dg_track}/license.txt | 2 +- .../textures/dg_track_road_black.png} | Bin .../textures/dg_track_road_white.png} | Bin mods/{trees => dg_trees}/README.txt | 0 mods/{trees => dg_trees}/init.lua | 19 +-- mods/{trees => dg_trees}/license.txt | 2 +- .../schematics/dg_trees_pine_tree.mts} | Bin .../textures/dg_trees_pine_needles.png} | Bin .../textures/dg_trees_pine_trunk_side.png} | Bin .../textures/dg_trees_pine_trunk_top.png} | Bin mods/driftcar/init.lua | 14 +- mods/light/init.lua | 17 --- mods/media/README.txt | 4 - mods/media/init.lua | 1 - mods/schematics/README.txt | 6 - mods/schematics/init.lua | 4 - mods/schematics/license.txt | 60 --------- mods/schematics/mod.conf | 1 - mods/schematics/save.lua | 100 --------------- .../textures => textures}/crack_anylength.png | Bin {mods/media => textures}/license.txt | 0 50 files changed, 153 insertions(+), 279 deletions(-) create mode 100644 .github/workflows/luacheck.yml create mode 100644 .luacheckrc rename mods/{gui => dg_gui}/README.txt (100%) rename mods/{gui => dg_gui}/init.lua (100%) rename mods/{gui => dg_gui}/license.txt (100%) rename mods/{gui => dg_gui}/textures/bubble.png (100%) rename mods/{gui => dg_gui}/textures/gui_formbg.png (100%) rename mods/{gui => dg_gui}/textures/heart.png (100%) rename mods/{hand => dg_hand}/README.txt (100%) rename mods/{hand => dg_hand}/init.lua (100%) rename mods/{hand => dg_hand}/license.txt (100%) rename mods/{hand => dg_hand}/textures/wieldhand.png (100%) rename mods/{light => dg_light}/README.txt (100%) create mode 100644 mods/dg_light/init.lua rename mods/{light => dg_light}/license.txt (98%) rename mods/{light/textures/light_light.png => dg_light/textures/dg_light_light.png} (100%) rename mods/{mapgen => dg_mapgen}/README.txt (100%) rename mods/{mapgen => dg_mapgen}/init.lua (56%) rename mods/{track => dg_mapgen}/license.txt (98%) rename mods/{mapgen/textures/mapgen_dirt.png => dg_mapgen/textures/dg_mapgen_dirt.png} (100%) rename mods/{mapgen/textures/mapgen_grass.png => dg_mapgen/textures/dg_mapgen_grass.png} (100%) rename mods/{mapgen/textures/mapgen_magma.png => dg_mapgen/textures/dg_mapgen_magma.png} (100%) rename mods/{mapgen/textures/mapgen_sand.png => dg_mapgen/textures/dg_mapgen_sand.png} (100%) rename mods/{mapgen/textures/mapgen_stone.png => dg_mapgen/textures/dg_mapgen_stone.png} (100%) rename mods/{mapgen/textures/mapgen_stone_block.png => dg_mapgen/textures/dg_mapgen_stone_block.png} (100%) rename mods/{mapgen/textures/mapgen_stone_block_divided.png => dg_mapgen/textures/dg_mapgen_stone_block_divided.png} (100%) rename mods/{mapgen/textures/mapgen_water.png => dg_mapgen/textures/dg_mapgen_water.png} (100%) rename mods/{track => dg_track}/README.txt (100%) rename mods/{track => dg_track}/init.lua (91%) rename mods/{mapgen => dg_track}/license.txt (98%) rename mods/{track/textures/track_road_black.png => dg_track/textures/dg_track_road_black.png} (100%) rename mods/{track/textures/track_road_white.png => dg_track/textures/dg_track_road_white.png} (100%) rename mods/{trees => dg_trees}/README.txt (100%) rename mods/{trees => dg_trees}/init.lua (55%) rename mods/{trees => dg_trees}/license.txt (98%) rename mods/{trees/schematics/trees_pine_tree.mts => dg_trees/schematics/dg_trees_pine_tree.mts} (100%) rename mods/{trees/textures/trees_pine_needles.png => dg_trees/textures/dg_trees_pine_needles.png} (100%) rename mods/{trees/textures/trees_pine_trunk_side.png => dg_trees/textures/dg_trees_pine_trunk_side.png} (100%) rename mods/{trees/textures/trees_pine_trunk_top.png => dg_trees/textures/dg_trees_pine_trunk_top.png} (100%) delete mode 100644 mods/light/init.lua delete mode 100644 mods/media/README.txt delete mode 100644 mods/media/init.lua delete mode 100644 mods/schematics/README.txt delete mode 100644 mods/schematics/init.lua delete mode 100644 mods/schematics/license.txt delete mode 100644 mods/schematics/mod.conf delete mode 100644 mods/schematics/save.lua rename {mods/media/textures => textures}/crack_anylength.png (100%) rename {mods/media => textures}/license.txt (100%) diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 0000000..b501650 --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -0,0 +1,10 @@ +name: luacheck +on: [push, pull_request] +jobs: + luacheck: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Luacheck + uses: lunarmodules/luacheck@master \ No newline at end of file diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..dc1e646 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,25 @@ +unused_args = false +allow_defined_top = true + +exclude_files = {".luacheckrc"} + +globals = { + "minetest", "core", + + --mod provided + "player_api", +} + +read_globals = { + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + + --luac + "math", "table", + + -- Builtin + "vector", "ItemStack", "dump", "DIR_DELIM", "VoxelArea", "Settings", "PcgRandom", "VoxelManip", "PseudoRandom", + + --mod produced + +} \ No newline at end of file diff --git a/mods/gui/README.txt b/mods/dg_gui/README.txt similarity index 100% rename from mods/gui/README.txt rename to mods/dg_gui/README.txt diff --git a/mods/gui/init.lua b/mods/dg_gui/init.lua similarity index 100% rename from mods/gui/init.lua rename to mods/dg_gui/init.lua diff --git a/mods/gui/license.txt b/mods/dg_gui/license.txt similarity index 100% rename from mods/gui/license.txt rename to mods/dg_gui/license.txt diff --git a/mods/gui/textures/bubble.png b/mods/dg_gui/textures/bubble.png similarity index 100% rename from mods/gui/textures/bubble.png rename to mods/dg_gui/textures/bubble.png diff --git a/mods/gui/textures/gui_formbg.png b/mods/dg_gui/textures/gui_formbg.png similarity index 100% rename from mods/gui/textures/gui_formbg.png rename to mods/dg_gui/textures/gui_formbg.png diff --git a/mods/gui/textures/heart.png b/mods/dg_gui/textures/heart.png similarity index 100% rename from mods/gui/textures/heart.png rename to mods/dg_gui/textures/heart.png diff --git a/mods/hand/README.txt b/mods/dg_hand/README.txt similarity index 100% rename from mods/hand/README.txt rename to mods/dg_hand/README.txt diff --git a/mods/hand/init.lua b/mods/dg_hand/init.lua similarity index 100% rename from mods/hand/init.lua rename to mods/dg_hand/init.lua diff --git a/mods/hand/license.txt b/mods/dg_hand/license.txt similarity index 100% rename from mods/hand/license.txt rename to mods/dg_hand/license.txt diff --git a/mods/hand/textures/wieldhand.png b/mods/dg_hand/textures/wieldhand.png similarity index 100% rename from mods/hand/textures/wieldhand.png rename to mods/dg_hand/textures/wieldhand.png diff --git a/mods/light/README.txt b/mods/dg_light/README.txt similarity index 100% rename from mods/light/README.txt rename to mods/dg_light/README.txt diff --git a/mods/dg_light/init.lua b/mods/dg_light/init.lua new file mode 100644 index 0000000..aaf370a --- /dev/null +++ b/mods/dg_light/init.lua @@ -0,0 +1,20 @@ +-- Register light + +minetest.register_node("dg_light:light", { + description = "Light", + tiles = {"dg_light_light.png"}, + paramtype = "light", + light_source = 14, + is_ground_content = false, + groups = {dig_immediate = 2}, +}) + +-- Give to new player + +minetest.register_on_newplayer(function(player) + local inv = player:get_inventory() + inv:add_item("main", "dg_light:light 64") +end) + +-- legacy compat (does require any nodes in inv to be placed and dug again for stacks to work) +minetest.register_alias("light:light", "dg_light:light") diff --git a/mods/light/license.txt b/mods/dg_light/license.txt similarity index 98% rename from mods/light/license.txt rename to mods/dg_light/license.txt index 58f8be1..fd30372 100644 --- a/mods/light/license.txt +++ b/mods/dg_light/license.txt @@ -2,7 +2,7 @@ License of source code ---------------------- The MIT License (MIT) -Copyright (C) 2019 paramat +Copyright (C) 2019-2023 paramat, wsor4035 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software diff --git a/mods/light/textures/light_light.png b/mods/dg_light/textures/dg_light_light.png similarity index 100% rename from mods/light/textures/light_light.png rename to mods/dg_light/textures/dg_light_light.png diff --git a/mods/mapgen/README.txt b/mods/dg_mapgen/README.txt similarity index 100% rename from mods/mapgen/README.txt rename to mods/dg_mapgen/README.txt diff --git a/mods/mapgen/init.lua b/mods/dg_mapgen/init.lua similarity index 56% rename from mods/mapgen/init.lua rename to mods/dg_mapgen/init.lua index c122d13..2f55454 100644 --- a/mods/mapgen/init.lua +++ b/mods/dg_mapgen/init.lua @@ -1,46 +1,46 @@ -- Register terrain nodes -minetest.register_node("mapgen:stone", { +minetest.register_node("dg_mapgen:stone", { description = "Stone", - tiles = {"mapgen_stone.png"}, + tiles = {"dg_mapgen_stone.png"}, groups = {cracky = 3}, }) -minetest.register_node("mapgen:grass", { +minetest.register_node("dg_mapgen:grass", { description = "Grass", - tiles = {"mapgen_grass.png"}, + tiles = {"dg_mapgen_grass.png"}, groups = {crumbly = 3}, }) -minetest.register_node("mapgen:dirt", { +minetest.register_node("dg_mapgen:dirt", { description = "Dirt", - tiles = {"mapgen_dirt.png"}, + tiles = {"dg_mapgen_dirt.png"}, groups = {crumbly = 3}, }) -minetest.register_node("mapgen:sand", { +minetest.register_node("dg_mapgen:sand", { description = "Sand", - tiles = {"mapgen_sand.png"}, + tiles = {"dg_mapgen_sand.png"}, groups = {crumbly = 3}, }) -- Register dungeon nodes -minetest.register_node("mapgen:stone_block", { +minetest.register_node("dg_mapgen:stone_block", { description = "Stone Block", - tiles = {"mapgen_stone_block.png"}, + tiles = {"dg_mapgen_stone_block.png"}, is_ground_content = false, groups = {dig_immediate = 2}, }) -minetest.register_node("mapgen:stone_block_stair", { +minetest.register_node("dg_mapgen:stone_block_stair", { description = "Stone Block Stair", drawtype = "nodebox", tiles = { - "mapgen_stone_block_divided.png", - "mapgen_stone_block.png", - "mapgen_stone_block_divided.png" + "dg_mapgen_stone_block_divided.png", + "dg_mapgen_stone_block.png", + "dg_mapgen_stone_block_divided.png" }, paramtype = "light", paramtype2 = "facedir", @@ -58,16 +58,16 @@ minetest.register_node("mapgen:stone_block_stair", { -- Register water nodes -minetest.register_node("mapgen:water_source", { +minetest.register_node("dg_mapgen:water_source", { description = "Water Source", drawtype = "liquid", tiles = { { - name = "mapgen_water.png", + name = "dg_mapgen_water.png", backface_culling = false, }, { - name = "mapgen_water.png", + name = "dg_mapgen_water.png", backface_culling = true, }, }, @@ -81,23 +81,23 @@ minetest.register_node("mapgen:water_source", { drop = "", drowning = 1, liquidtype = "source", - liquid_alternative_flowing = "mapgen:water_flowing", - liquid_alternative_source = "mapgen:water_source", + liquid_alternative_flowing = "dg_mapgen:water_flowing", + liquid_alternative_source = "dg_mapgen:water_source", liquid_viscosity = 1, post_effect_color = {a = 103, r = 30, g = 60, b = 90}, }) -minetest.register_node("mapgen:water_flowing", { +minetest.register_node("dg_mapgen:water_flowing", { description = "Flowing Water", drawtype = "flowingliquid", - tiles = {"mapgen_water.png"}, + tiles = {"dg_mapgen_water.png"}, special_tiles = { { - name = "mapgen_water.png", + name = "dg_mapgen_water.png", backface_culling = false, }, { - name = "mapgen_water.png", + name = "dg_mapgen_water.png", backface_culling = false, }, }, @@ -112,8 +112,8 @@ minetest.register_node("mapgen:water_flowing", { drop = "", drowning = 1, liquidtype = "flowing", - liquid_alternative_flowing = "mapgen:water_flowing", - liquid_alternative_source = "mapgen:water_source", + liquid_alternative_flowing = "dg_mapgen:water_flowing", + liquid_alternative_source = "dg_mapgen:water_source", liquid_viscosity = 1, post_effect_color = {a = 103, r = 30, g = 60, b = 90}, groups = {not_in_creative_inventory = 1}, @@ -122,16 +122,16 @@ minetest.register_node("mapgen:water_flowing", { -- Register magma nodes -minetest.register_node("mapgen:magma_source", { +minetest.register_node("dg_mapgen:magma_source", { description = "Magma Source", drawtype = "liquid", tiles = { { - name = "mapgen_magma.png", + name = "dg_mapgen_magma.png", backface_culling = false, }, { - name = "mapgen_magma.png", + name = "dg_mapgen_magma.png", backface_culling = true, }, }, @@ -145,25 +145,25 @@ minetest.register_node("mapgen:magma_source", { drop = "", drowning = 1, liquidtype = "source", - liquid_alternative_flowing = "mapgen:magma_flowing", - liquid_alternative_source = "mapgen:magma_source", + liquid_alternative_flowing = "dg_mapgen:magma_flowing", + liquid_alternative_source = "dg_mapgen:magma_source", liquid_viscosity = 7, liquid_renewable = false, damage_per_second = 4 * 2, post_effect_color = {a = 191, r = 255, g = 64, b = 0}, }) -minetest.register_node("mapgen:magma_flowing", { +minetest.register_node("dg_mapgen:magma_flowing", { description = "Flowing Magma", drawtype = "flowingliquid", - tiles = {"mapgen_magma.png"}, + tiles = {"dg_mapgen_magma.png"}, special_tiles = { { - name = "mapgen_magma.png", + name = "dg_mapgen_magma.png", backface_culling = false, }, { - name = "mapgen_magma.png", + name = "dg_mapgen_magma.png", backface_culling = false, }, }, @@ -178,8 +178,8 @@ minetest.register_node("mapgen:magma_flowing", { drop = "", drowning = 1, liquidtype = "flowing", - liquid_alternative_flowing = "mapgen:magma_flowing", - liquid_alternative_source = "mapgen:magma_source", + liquid_alternative_flowing = "dg_mapgen:magma_flowing", + liquid_alternative_source = "dg_mapgen:magma_source", liquid_viscosity = 7, liquid_renewable = false, damage_per_second = 4 * 2, @@ -190,9 +190,9 @@ minetest.register_node("mapgen:magma_flowing", { -- Register aliases for map generators -minetest.register_alias("mapgen_stone", "mapgen:stone") -minetest.register_alias("mapgen_water_source", "mapgen:water_source") -minetest.register_alias("mapgen_river_water_source", "mapgen:water_source") +minetest.register_alias("mapgen_stone", "dg_mapgen:stone") +minetest.register_alias("mapgen_water_source", "dg_mapgen:water_source") +minetest.register_alias("mapgen_river_water_source", "dg_mapgen:water_source") -- Register biomes @@ -203,15 +203,15 @@ minetest.register_alias("mapgen_river_water_source", "mapgen:water_source") minetest.register_biome({ name = "grassland", - node_top = "mapgen:grass", + node_top = "dg_mapgen:grass", depth_top = 1, - node_filler = "mapgen:dirt", + node_filler = "dg_mapgen:dirt", depth_filler = 2, - node_riverbed = "mapgen:sand", + node_riverbed = "dg_mapgen:sand", depth_riverbed = 2, - node_cave_liquid = "mapgen:water_source", - node_dungeon = "mapgen:stone_block", - node_dungeon_stair = "mapgen:stone_block_stair", + node_cave_liquid = "dg_mapgen:water_source", + node_dungeon = "dg_mapgen:stone_block", + node_dungeon_stair = "dg_mapgen:stone_block_stair", y_max = 31000, y_min = 4, heat_point = 50, @@ -222,15 +222,15 @@ minetest.register_biome({ minetest.register_biome({ name = "grassland_sea", - node_top = "mapgen:sand", + node_top = "dg_mapgen:sand", depth_top = 1, - node_filler = "mapgen:sand", + node_filler = "dg_mapgen:sand", depth_filler = 2, - node_riverbed = "mapgen:sand", + node_riverbed = "dg_mapgen:sand", depth_riverbed = 2, - node_cave_liquid = "mapgen:water_source", - node_dungeon = "mapgen:stone_block", - node_dungeon_stair = "mapgen:stone_block_stair", + node_cave_liquid = "dg_mapgen:water_source", + node_dungeon = "dg_mapgen:stone_block", + node_dungeon_stair = "dg_mapgen:stone_block_stair", vertical_blend = 1, y_max = 3, y_min = -127, @@ -242,9 +242,9 @@ minetest.register_biome({ minetest.register_biome({ name = "grassland_under", - node_cave_liquid = "mapgen:water_source", - node_dungeon = "mapgen:stone_block", - node_dungeon_stair = "mapgen:stone_block_stair", + node_cave_liquid = "dg_mapgen:water_source", + node_dungeon = "dg_mapgen:stone_block", + node_dungeon_stair = "dg_mapgen:stone_block_stair", y_max = -128, y_min = -1023, heat_point = 50, @@ -255,11 +255,17 @@ minetest.register_biome({ minetest.register_biome({ name = "grassland_deep", - node_cave_liquid = {"mapgen:water_source", "mapgen:magma_source"}, - node_dungeon = "mapgen:stone_block", - node_dungeon_stair = "mapgen:stone_block_stair", + node_cave_liquid = {"dg_mapgen:water_source", "dg_mapgen:magma_source"}, + node_dungeon = "dg_mapgen:stone_block", + node_dungeon_stair = "dg_mapgen:stone_block_stair", y_max = -1024, y_min = -31000, heat_point = 50, humidity_point = 50, }) + +for nodename, _ in pairs(minetest.registered_nodes) do + if nodename:split(":")[1] == "dg_mapgen" then + minetest.register_alias("mapgen:" .. nodename:split(":")[2], nodename) + end +end diff --git a/mods/track/license.txt b/mods/dg_mapgen/license.txt similarity index 98% rename from mods/track/license.txt rename to mods/dg_mapgen/license.txt index 4f2e2e0..33e9009 100644 --- a/mods/track/license.txt +++ b/mods/dg_mapgen/license.txt @@ -2,7 +2,7 @@ License of source code ---------------------- The MIT License (MIT) -Copyright (C) 2020 paramat +Copyright (C) 2020-2023 paramat, wsor4035 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software diff --git a/mods/mapgen/textures/mapgen_dirt.png b/mods/dg_mapgen/textures/dg_mapgen_dirt.png similarity index 100% rename from mods/mapgen/textures/mapgen_dirt.png rename to mods/dg_mapgen/textures/dg_mapgen_dirt.png diff --git a/mods/mapgen/textures/mapgen_grass.png b/mods/dg_mapgen/textures/dg_mapgen_grass.png similarity index 100% rename from mods/mapgen/textures/mapgen_grass.png rename to mods/dg_mapgen/textures/dg_mapgen_grass.png diff --git a/mods/mapgen/textures/mapgen_magma.png b/mods/dg_mapgen/textures/dg_mapgen_magma.png similarity index 100% rename from mods/mapgen/textures/mapgen_magma.png rename to mods/dg_mapgen/textures/dg_mapgen_magma.png diff --git a/mods/mapgen/textures/mapgen_sand.png b/mods/dg_mapgen/textures/dg_mapgen_sand.png similarity index 100% rename from mods/mapgen/textures/mapgen_sand.png rename to mods/dg_mapgen/textures/dg_mapgen_sand.png diff --git a/mods/mapgen/textures/mapgen_stone.png b/mods/dg_mapgen/textures/dg_mapgen_stone.png similarity index 100% rename from mods/mapgen/textures/mapgen_stone.png rename to mods/dg_mapgen/textures/dg_mapgen_stone.png diff --git a/mods/mapgen/textures/mapgen_stone_block.png b/mods/dg_mapgen/textures/dg_mapgen_stone_block.png similarity index 100% rename from mods/mapgen/textures/mapgen_stone_block.png rename to mods/dg_mapgen/textures/dg_mapgen_stone_block.png diff --git a/mods/mapgen/textures/mapgen_stone_block_divided.png b/mods/dg_mapgen/textures/dg_mapgen_stone_block_divided.png similarity index 100% rename from mods/mapgen/textures/mapgen_stone_block_divided.png rename to mods/dg_mapgen/textures/dg_mapgen_stone_block_divided.png diff --git a/mods/mapgen/textures/mapgen_water.png b/mods/dg_mapgen/textures/dg_mapgen_water.png similarity index 100% rename from mods/mapgen/textures/mapgen_water.png rename to mods/dg_mapgen/textures/dg_mapgen_water.png diff --git a/mods/track/README.txt b/mods/dg_track/README.txt similarity index 100% rename from mods/track/README.txt rename to mods/dg_track/README.txt diff --git a/mods/track/init.lua b/mods/dg_track/init.lua similarity index 91% rename from mods/track/init.lua rename to mods/dg_track/init.lua index 8922d8a..961e5f8 100644 --- a/mods/track/init.lua +++ b/mods/dg_track/init.lua @@ -56,22 +56,25 @@ local np_blend = { -- Nodes -minetest.register_node("track:road_black", { +minetest.register_node("dg_track:road_black", { description = "Road Black", - tiles = {"track_road_black.png"}, + tiles = {"dg_track_road_black.png"}, is_ground_content = false, groups = {cracky = 3}, }) -minetest.register_node("track:road_white", { +minetest.register_node("dg_track:road_white", { description = "Road White", - tiles = {"track_road_white.png"}, + tiles = {"dg_track_road_white.png"}, paramtype = "light", light_source = 12, is_ground_content = false, groups = {cracky = 3}, }) +minetest.register_alias("track:road_black", "dg_track:road_black") +minetest.register_alias("track:road_white", "dg_track:road_white") + -- Set mapgen flags to disable core mapgen decoration placement. -- Tree decorations are placed using the Lua Voxel Manipulator after track generation @@ -82,8 +85,8 @@ minetest.set_mapgen_setting("mg_flags", "caves,dungeons,light,nodecorations,biom -- Constants -local c_roadblack = minetest.get_content_id("track:road_black") -local c_roadwhite = minetest.get_content_id("track:road_white") +local c_roadblack = minetest.get_content_id("dg_track:road_black") +local c_roadwhite = minetest.get_content_id("dg_track:road_white") -- Initialise noise object, noise table, voxelmanip table @@ -111,12 +114,12 @@ minetest.register_on_generated(function(minp, maxp, seed) --local t1 = os.clock() local x1 = maxp.x - local y1 = maxp.y + --local y1 = maxp.y local z1 = maxp.z local x0 = minp.x - local y0 = minp.y + --local y0 = minp.y local z0 = minp.z - + -- Noise map extends from x0/z0 - 5 to x1/z1 + 4, one node larger than the track brush -- centre generation area, to allow sign change of noise to be detected along minimum -- edges of track brush centre generation area. @@ -193,7 +196,7 @@ minetest.register_on_generated(function(minp, maxp, seed) n_xprepath2 = n_path2 end end - + vm:set_data(data) minetest.generate_decorations(vm) vm:set_lighting({day = 0, night = 0}) diff --git a/mods/mapgen/license.txt b/mods/dg_track/license.txt similarity index 98% rename from mods/mapgen/license.txt rename to mods/dg_track/license.txt index 4f2e2e0..33e9009 100644 --- a/mods/mapgen/license.txt +++ b/mods/dg_track/license.txt @@ -2,7 +2,7 @@ License of source code ---------------------- The MIT License (MIT) -Copyright (C) 2020 paramat +Copyright (C) 2020-2023 paramat, wsor4035 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software diff --git a/mods/track/textures/track_road_black.png b/mods/dg_track/textures/dg_track_road_black.png similarity index 100% rename from mods/track/textures/track_road_black.png rename to mods/dg_track/textures/dg_track_road_black.png diff --git a/mods/track/textures/track_road_white.png b/mods/dg_track/textures/dg_track_road_white.png similarity index 100% rename from mods/track/textures/track_road_white.png rename to mods/dg_track/textures/dg_track_road_white.png diff --git a/mods/trees/README.txt b/mods/dg_trees/README.txt similarity index 100% rename from mods/trees/README.txt rename to mods/dg_trees/README.txt diff --git a/mods/trees/init.lua b/mods/dg_trees/init.lua similarity index 55% rename from mods/trees/init.lua rename to mods/dg_trees/init.lua index 801958b..5297f15 100644 --- a/mods/trees/init.lua +++ b/mods/dg_trees/init.lua @@ -1,22 +1,25 @@ -- Nodes -minetest.register_node("trees:pine_trunk", { +minetest.register_node("dg_trees:pine_trunk", { description = "Pine Trunk", tiles = { - "trees_pine_trunk_top.png", - "trees_pine_trunk_top.png", - "trees_pine_trunk_side.png", + "dg_trees_pine_trunk_top.png", + "dg_trees_pine_trunk_top.png", + "dg_trees_pine_trunk_side.png", }, groups = {choppy = 2}, }) -minetest.register_node("trees:pine_needles", { +minetest.register_node("dg_trees:pine_needles", { description = "Pine Needles", - tiles = {"trees_pine_needles.png"}, + tiles = {"dg_trees_pine_needles.png"}, walkable = false, groups = {dig_immediate = 2}, }) +minetest.register_alias("trees:pine_trunk", "dg_trees:pine_trunk") +minetest.register_alias("trees:pine_needles", "dg_trees:pine_needles") + -- Decoration. -- Placed by voxelmanip in 'track' mod, not by core mapgen, so use: @@ -24,7 +27,7 @@ minetest.register_node("trees:pine_needles", { minetest.register_decoration({ deco_type = "schematic", - place_on = {"mapgen:grass"}, + place_on = {"dg_mapgen:grass"}, sidelen = 16, noise_params = { offset = 0.0, @@ -37,6 +40,6 @@ minetest.register_decoration({ biomes = {"grassland"}, y_min = -31000, y_max = 31000, - schematic = minetest.get_modpath("trees").."/schematics/trees_pine_tree.mts", + schematic = minetest.get_modpath("dg_trees").."/schematics/dg_trees_pine_tree.mts", flags = "place_center_x, place_center_z", }) diff --git a/mods/trees/license.txt b/mods/dg_trees/license.txt similarity index 98% rename from mods/trees/license.txt rename to mods/dg_trees/license.txt index df39686..1e8fd93 100644 --- a/mods/trees/license.txt +++ b/mods/dg_trees/license.txt @@ -2,7 +2,7 @@ License of source code ---------------------- The MIT License (MIT) -Copyright (C) 2020 paramat +Copyright (C) 2020-2023 paramat, wsor4035 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software diff --git a/mods/trees/schematics/trees_pine_tree.mts b/mods/dg_trees/schematics/dg_trees_pine_tree.mts similarity index 100% rename from mods/trees/schematics/trees_pine_tree.mts rename to mods/dg_trees/schematics/dg_trees_pine_tree.mts diff --git a/mods/trees/textures/trees_pine_needles.png b/mods/dg_trees/textures/dg_trees_pine_needles.png similarity index 100% rename from mods/trees/textures/trees_pine_needles.png rename to mods/dg_trees/textures/dg_trees_pine_needles.png diff --git a/mods/trees/textures/trees_pine_trunk_side.png b/mods/dg_trees/textures/dg_trees_pine_trunk_side.png similarity index 100% rename from mods/trees/textures/trees_pine_trunk_side.png rename to mods/dg_trees/textures/dg_trees_pine_trunk_side.png diff --git a/mods/trees/textures/trees_pine_trunk_top.png b/mods/dg_trees/textures/dg_trees_pine_trunk_top.png similarity index 100% rename from mods/trees/textures/trees_pine_trunk_top.png rename to mods/dg_trees/textures/dg_trees_pine_trunk_top.png diff --git a/mods/driftcar/init.lua b/mods/driftcar/init.lua index f414566..16a9680 100644 --- a/mods/driftcar/init.lua +++ b/mods/driftcar/init.lua @@ -192,7 +192,7 @@ function car.on_detach_child(self, child) end -local sound_cyc = 0 +--local sound_cyc = 0 function car.on_step(self, dtime) local vel = self.object:getvelocity() @@ -251,7 +251,7 @@ function car.on_step(self, dtime) taccmag = -grip * torm end end - end + end end -- Early return for near-stationary vehicle with driver @@ -284,7 +284,7 @@ function car.on_step(self, dtime) end noturnctrl = false end - end + end end -- If no turn control adjust turn towards zero @@ -424,13 +424,13 @@ minetest.register_craftitem("driftcar:driftcar", { end pointed_thing.under.y = pointed_thing.under.y + 1.25 - local car = minetest.add_entity(pointed_thing.under, + local car_entity = minetest.add_entity(pointed_thing.under, "driftcar:driftcar") - if car then + if car_entity then if placer then - car:setyaw(placer:get_look_horizontal()) + car_entity:setyaw(placer:get_look_horizontal()) end - local player_name = placer and placer:get_player_name() or "" + --local player_name = placer and placer:get_player_name() or "" itemstack:take_item() end return itemstack diff --git a/mods/light/init.lua b/mods/light/init.lua deleted file mode 100644 index 15adf75..0000000 --- a/mods/light/init.lua +++ /dev/null @@ -1,17 +0,0 @@ --- Register light - -minetest.register_node("light:light", { - description = "Light", - tiles = {"light_light.png"}, - paramtype = "light", - light_source = 14, - is_ground_content = false, - groups = {dig_immediate = 2}, -}) - --- Give to new player - -minetest.register_on_newplayer(function(player) - local inv = player:get_inventory() - inv:add_item("main", "light:light 64") -end) diff --git a/mods/media/README.txt b/mods/media/README.txt deleted file mode 100644 index 32081b5..0000000 --- a/mods/media/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -Minipeli mod: media -=================== - -All textures by paramat (CC BY-SA 3.0). diff --git a/mods/media/init.lua b/mods/media/init.lua deleted file mode 100644 index ade0d26..0000000 --- a/mods/media/init.lua +++ /dev/null @@ -1 +0,0 @@ --- Necessary empty file diff --git a/mods/schematics/README.txt b/mods/schematics/README.txt deleted file mode 100644 index 0447ec2..0000000 --- a/mods/schematics/README.txt +++ /dev/null @@ -1,6 +0,0 @@ -driftgame mod: schematics -========================= - -Derived from 'saveschems' mod by paramat and sofar. -Source code by paramat and sofar (MIT). -Schematics by paramat (CC BY-SA 3.0). diff --git a/mods/schematics/init.lua b/mods/schematics/init.lua deleted file mode 100644 index 6d485a8..0000000 --- a/mods/schematics/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -local path = minetest.get_modpath("schematics") - --- Uncomment to create .mts files ---dofile(path .. "/save.lua") diff --git a/mods/schematics/license.txt b/mods/schematics/license.txt deleted file mode 100644 index bcc5259..0000000 --- a/mods/schematics/license.txt +++ /dev/null @@ -1,60 +0,0 @@ -License of source code ----------------------- - -The MIT License (MIT) -Copyright (C) 2020 paramat -Copyright (C) 2020 sofar - -Permission is hereby granted, free of charge, to any person obtaining a copy of this -software and associated documentation files (the "Software"), to deal in the Software -without restriction, including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or -substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -For more details: -https://opensource.org/licenses/MIT - - -Licenses of media ------------------ - -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -Copyright (C) 2020 paramat - -You are free to: -Share — copy and redistribute the material in any medium or format. -Adapt — remix, transform, and build upon the material for any purpose, even commercially. -The licensor cannot revoke these freedoms as long as you follow the license terms. - -Under the following terms: - -Attribution — You must give appropriate credit, provide a link to the license, and -indicate if changes were made. You may do so in any reasonable manner, but not in any way -that suggests the licensor endorses you or your use. - -ShareAlike — If you remix, transform, or build upon the material, you must distribute -your contributions under the same license as the original. - -No additional restrictions — You may not apply legal terms or technological measures that -legally restrict others from doing anything the license permits. - -Notices: - -You do not have to comply with the license for elements of the material in the public -domain or where your use is permitted by an applicable exception or limitation. -No warranties are given. The license may not give you all of the permissions necessary -for your intended use. For example, other rights such as publicity, privacy, or moral -rights may limit how you use the material. - -For more details: -http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/schematics/mod.conf b/mods/schematics/mod.conf deleted file mode 100644 index 608ac9c..0000000 --- a/mods/schematics/mod.conf +++ /dev/null @@ -1 +0,0 @@ -depends = trees diff --git a/mods/schematics/save.lua b/mods/schematics/save.lua deleted file mode 100644 index 9b60ff1..0000000 --- a/mods/schematics/save.lua +++ /dev/null @@ -1,100 +0,0 @@ --- Schematic file format version 4 - --- Standard table format, structure appears inverted in each z slice. --- Z, Y and X are formatted in increasing order. - -local mts_save = function(name, schematic) - local s = minetest.serialize_schematic(schematic, "mts", {}) - local path = minetest.get_modpath("schematics") .. "/schematics" - local filename = path .. "/" .. name .. ".mts" - filename = filename:gsub("\"", "\\\""):gsub("\\", "\\\\") - local file, err = io.open(filename, "wb") - if err == nil then - file:write(s) - file:flush() - file:close() - end - print("Wrote: " .. filename) -end - -local _ = {name = "air", prob = 0} - --- Mapgen small pine tree - -local L = {name = "trees:pine_needles", prob = 255} -local T = {name = "trees:pine_trunk", prob = 255, force_place = true} - -mts_save("trees_pine_tree", { - size = {x = 5, y = 12, z = 5}, - data = { - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, L, L, L, _, - _, _, L, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - L, L, _, L, L, - _, L, L, L, _, - _, L, L, L, _, - _, L, L, L, _, - _, _, L, _, _, - _, _, L, _, _, - _, _, _, _, _, - _, _, _, _, _, - - _, _, T, _, _, - _, _, T, _, _, - _, _, T, _, _, - _, _, T, _, _, - L, _, T, _, L, - L, L, T, L, L, - _, L, T, L, _, - _, L, T, L, _, - _, L, L, L, _, - _, L, L, L, _, - _, _, L, _, _, - _, _, L, _, _, - - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - L, L, _, L, L, - _, L, L, L, _, - _, L, L, L, _, - _, L, L, L, _, - _, _, L, _, _, - _, _, L, _, _, - _, _, _, _, _, - _, _, _, _, _, - - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, L, L, L, _, - _, _, L, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - _, _, _, _, _, - }, - yslice_prob = { - {ypos = 2, prob = 127}, - {ypos = 3, prob = 127}, - {ypos = 4, prob = 127}, - }, -}) diff --git a/mods/media/textures/crack_anylength.png b/textures/crack_anylength.png similarity index 100% rename from mods/media/textures/crack_anylength.png rename to textures/crack_anylength.png diff --git a/mods/media/license.txt b/textures/license.txt similarity index 100% rename from mods/media/license.txt rename to textures/license.txt