Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dp_modpack game agnostic using XCompat #14

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ read_globals = {
"minetest",
"table",
"vector",
"default"
"xcompat"
}

globals = {
Expand Down
22 changes: 13 additions & 9 deletions boards/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ local function set_formspec(pos)
local meta = minetest.get_meta(pos)
local display_text = minetest.formspec_escape(meta:get_string("display_text"))
meta:set_string("formspec",
"size[6,3.5]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
"size[6,3.5]"..
"textarea[0.55,0.25;5.5,3;display_text;"..FS("Text")..";" .. display_text .. "]"..
"button_exit[1,2.75;2,1;ok;"..FS("Write").."]"..
"button[3,2.75;2,1;font;"..FS("Font").."]")
Expand All @@ -52,6 +52,8 @@ local function on_receive_fields(pos, formname, fields, player)
end
end

local wood_texture = xcompat.textures.wood.planks

local models = {
black_board = {
depth = 1/16, width = 1, height = 1,
Expand All @@ -65,9 +67,9 @@ local models = {
},
node_fields = {
description = S("Black board"),
tiles = { "default_wood.png", "default_wood.png",
"default_wood.png", "default_wood.png",
"default_wood.png", "board_black_front.png" },
tiles = {wood_texture, wood_texture,
wood_texture, wood_texture,
wood_texture, "board_black_front.png"},
_itemframe_texture = "board_black_front.png",
drawtype = "nodebox",
node_box = {
Expand Down Expand Up @@ -103,9 +105,9 @@ local models = {
},
node_fields = {
description = S("Green board"),
tiles = { "default_wood.png", "default_wood.png",
"default_wood.png", "default_wood.png",
"default_wood.png", "board_green_front.png" },
tiles = {wood_texture, wood_texture,
wood_texture, wood_texture,
wood_texture, "board_green_front.png"},
drawtype = "nodebox",
_itemframe_texture = "board_green_front.png",
node_box = {
Expand Down Expand Up @@ -138,19 +140,21 @@ do
end

-- Recipes
local mat = xcompat.materials

minetest.register_craft(
{
output = "boards:black_board",
recipe = {
{"group:wood", "group:stone", "dye:black"},
{"group:wood", "group:stone", mat.dye_black},
}
})

minetest.register_craft(
{
output = "boards:green_board",
recipe = {
{"group:wood", "group:stone", "dye:dark_green"},
{"group:wood", "group:stone", mat.dye_dark_green},
}
})

2 changes: 1 addition & 1 deletion boards/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = boards
title = Black boards
description = Writable school boards using sign_api
depends = default,signs_api
depends = signs_api, xcompat
2 changes: 1 addition & 1 deletion display_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This library's purpose is to ease creation of nodes with one or more displays on

**Limitations**: This lib uses entities to draw display. This means display has to be vertical (and "upside up") on Minetest before version 5.0.

**Dependancies**:default
**Dependencies**: xcompat

**License**: LGPLv2

Expand Down
2 changes: 1 addition & 1 deletion font_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A library for rendernig text on textures (to be used with display_api for sign creation).

**Dependancies**: default
**Dependencies**: xcompat

**License**: LGPL

Expand Down
5 changes: 2 additions & 3 deletions font_api/fontform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ local function show_font_formspec(playername)
table.sort(fonts)

local fs = string.format(
"size[4,%s]%s%s%sbutton_exit[0,%s;4,1;cancel;%s]",
#fonts + 0.8, default.gui_bg, default.gui_bg_img, default.gui_slots,
#fonts, FS("Cancel"))
"size[4,%s]button_exit[0,%s;4,1;cancel;%s]",
#fonts + 0.8, #fonts, FS("Cancel"))

for line = 1, #fonts do
local font = font_api.get_font(fonts[line])
Expand Down
2 changes: 1 addition & 1 deletion ontime_clocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This mod provides clocks that display real ingame time.

For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.

**Dependancies**: display_api, default
**Dependencies**: display_api, xcompat

**License**: Code under LGPL, textures under CC-BY-SA

Expand Down
26 changes: 14 additions & 12 deletions ontime_clocks/crafts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,58 @@
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
--]]

local mat = xcompat.materials

minetest.register_craft({
output = 'ontime_clocks:green_digital',
recipe = {
{'', 'dye:green', ''},
{'default:glass', 'default:mese_crystal', 'default:glass'},
{'', mat.dye_green, ''},
{mat.glass, mat.mese_crystal, mat.glass},
{'', '', ''},
}
})

minetest.register_craft({
output = 'ontime_clocks:red_digital',
recipe = {
{'', 'dye:red', ''},
{'default:glass', 'default:mese_crystal', 'default:glass'},
{'', mat.dye_red, ''},
{mat.glass, mat.mese_crystal, mat.glass},
{'', '', ''},
}
})

minetest.register_craft({
output = 'ontime_clocks:white',
recipe = {
{'default:steel_ingot', 'default:paper', 'default:steel_ingot'},
{'', 'default:mese_crystal', ''},
{mat.steel_ingot, mat.paper, mat.steel_ingot},
{'', mat.mese_crystal, ''},
{'', '', ''},
}
})

minetest.register_craft({
output = 'ontime_clocks:frameless_black',
recipe = {
{'default:steel_ingot', 'dye:black', 'default:steel_ingot'},
{'', 'default:mese_crystal', ''},
{mat.steel_ingot, mat.dye_black, mat.steel_ingot},
{'', mat.mese_crystal, ''},
{'', '', ''},
}
})

minetest.register_craft({
output = 'ontime_clocks:frameless_gold',
recipe = {
{'default:gold_ingot', '', 'default:gold_ingot'},
{'', 'default:mese_crystal', ''},
{mat.gold_ingot, '', mat.gold_ingot},
{'', mat.mese_crystal, ''},
{'', '', ''},
}
})

minetest.register_craft({
output = 'ontime_clocks:frameless_white',
recipe = {
{'default:steel_ingot', 'dye:white', 'default:steel_ingot'},
{'', 'default:mese_crystal', ''},
{mat.steel_ingot, mat.dye_white, mat.steel_ingot},
{'', mat.mese_crystal, ''},
{'', '', ''},
}
})
Expand Down
2 changes: 1 addition & 1 deletion ontime_clocks/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = ontime_clocks
title = Ontime Clocks
description = Clocks displaing real ingame time
depends = default,dye,display_api
depends = display_api, xcompat
2 changes: 1 addition & 1 deletion signs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This mod provides various signs with text display. Text is locked if area is pro

For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.

**Dependancies**: default, display\_lib, font\_lib
**Dependencies**: xcompat, display\_lib, font\_lib

**License**: Code under LGPL, Textures and models under CC-BY-SA

Expand Down
18 changes: 10 additions & 8 deletions signs/crafts.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
local mat = xcompat.materials

minetest.register_craft({
output = 'signs:wooden_right_sign',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'group:wood', 'dye:black'},
{'group:wood', 'group:wood', mat.dye_black},
{'', '', ''},
}
})
Expand All @@ -16,7 +18,7 @@ minetest.register_craft({
minetest.register_craft({
output = 'signs:wooden_long_sign',
recipe = {
{'group:wood', 'dye:black', 'group:wood'},
{'group:wood', mat.dye_black, 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
{'', '', ''},
}
Expand All @@ -31,7 +33,7 @@ minetest.register_craft({
minetest.register_craft({
output = 'signs:wooden_sign',
recipe = {
{'', 'dye:black', ''},
{'', mat.dye_black, ''},
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
}
Expand All @@ -40,22 +42,22 @@ minetest.register_craft({
minetest.register_craft({
output = 'signs:paper_poster',
recipe = {
{'default:paper', 'default:paper', 'dye:black'},
{'default:paper', 'default:paper', ''},
{'default:paper', 'default:paper', ''},
{mat.paper, mat.paper, mat.dye_black},
{mat.paper, mat.paper, ''},
{mat.paper, mat.paper, ''},
}
})

minetest.register_craft({
output = 'signs:label_small',
recipe = {
{'default:paper', 'dye:black'},
{mat.paper, mat.dye_black},
}
})

minetest.register_craft({
output = 'signs:label_medium',
recipe = {
{'default:paper', 'default:paper', 'dye:black'},
{mat.paper, mat.paper, mat.dye_black},
}
})
2 changes: 1 addition & 1 deletion signs/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = signs
title = Signs
description = Basic signs and posters with text display using signs_api
depends = default,dye,signs_api
depends = signs_api, xcompat
4 changes: 2 additions & 2 deletions signs/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ local function edit_poster(pos, node, player)

if not minetest.is_protected(pos, player:get_player_name()) then
fs = string.format([=[
size[6.5,7.5]%s%s%s
size[6.5,7.5]
field[0.5,0.7;6,1;display_text;%s;%s]
textarea[0.5,1.7;6,6;text;%s;%s]
button[1.25,7;2,1;font;%s]
button_exit[3.25,7;2,1;write;%s]]=],
default.gui_bg, default.gui_bg_img, default.gui_slots, FS("Title"),
FS("Title"),
minetest.formspec_escape(meta:get_string("display_text")),
FS("Text"), minetest.formspec_escape(meta:get_string("text")),
FS("Title font"), FS("Write"))
Expand Down
2 changes: 1 addition & 1 deletion signs_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ No actual signs get registered by this mod, the signs are defined in the sign su

For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.

**Dependancies**: default, display\_lib, font\_lib
**Dependencies**: xcompat, display\_lib, font\_lib

**License**: Code under LGPL, Textures and models under CC-BY-SA

Expand Down
5 changes: 2 additions & 3 deletions signs_api/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ function signs_api.set_formspec(pos)
fs = fs.."button[1,"..y..";2,1;font;"..FS("Font").."]"
fs = fs.."button_exit[3,"..y..";2,1;ok;"..FS("Write").."]"
y = y + 0.8
fs = "size[6,"..y.."]"..default.gui_bg..
default.gui_bg_img..default.gui_slots..fs
fs = "size[6,"..y.."]"..fs

meta:set_string("formspec", fs)
end
Expand Down Expand Up @@ -171,7 +170,7 @@ function signs_api.register_sign(mod, name, model)
},
groups = {choppy=2, dig_immediate=2, not_blocking_trains=1, display_api=1,signs_api_formspec_lbm=1},
is_ground_content = false,
sounds = default.node_sound_defaults(),
sounds = xcompat.sounds.node_sound_default(),
display_entities = {
["signs:display_text"] = {
on_display_update = font_api.on_display_update,
Expand Down
2 changes: 1 addition & 1 deletion signs_api/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = signs_api
title = Signs API
description = A library providing various helper functions for registereing signs with text display
depends = default,display_api,font_api
depends = display_api, font_api, xcompat
2 changes: 1 addition & 1 deletion signs_road/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This mod provides road signs with text display. Text is locked if area is protec

For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.

**Dependancies**: default, display\_lib, font\_lib, signs
**Dependencies**: xcompat, display\_lib, font\_lib, signs

**License**: Code under LGPL, texture under CC-BY-SA

Expand Down
Loading