Skip to content

Commit

Permalink
Namespacing (#2)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wsor4035 authored Nov 26, 2023
1 parent f3b14d2 commit 6c255b5
Show file tree
Hide file tree
Showing 50 changed files with 153 additions and 279 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -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

}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
20 changes: 20 additions & 0 deletions mods/dg_light/init.lua
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion mods/light/license.txt → mods/dg_light/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes
File renamed without changes.
120 changes: 63 additions & 57 deletions mods/mapgen/init.lua → mods/dg_mapgen/init.lua
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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,
},
},
Expand All @@ -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,
},
},
Expand All @@ -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},
Expand All @@ -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,
},
},
Expand All @@ -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,
},
},
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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
2 changes: 1 addition & 1 deletion mods/track/license.txt → mods/dg_mapgen/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Loading

0 comments on commit 6c255b5

Please sign in to comment.