forked from mtcontrib/factions
Remove: optional_depends
This commit is contained in:
parent
c531294335
commit
0dd50e7141
@ -123,14 +123,6 @@ factions.register_command = function(cmd_name, cmd, ignore_param_count, or_perm,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factions.register_commands = function(cmd_names, cmd, ignore_param_count, or_perm)
|
|
||||||
local hide = false
|
|
||||||
for k, v in pairs(cmd_names) do
|
|
||||||
factions.register_command(k, cmd, ignore_param_count, or_perm, hide)
|
|
||||||
hide = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local init_commands
|
local init_commands
|
||||||
init_commands = function()
|
init_commands = function()
|
||||||
|
|
||||||
@ -1670,9 +1662,9 @@ local premade_help = ""
|
|||||||
|
|
||||||
local premade_help_admin = ""
|
local premade_help_admin = ""
|
||||||
|
|
||||||
local a_z = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
|
local a_z = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
function factions.create_help_text()
|
||||||
for l, j in pairs(a_z) do
|
for l, j in pairs(a_z) do
|
||||||
for k, v in pairs(factions.commands) do
|
for k, v in pairs(factions.commands) do
|
||||||
if k:sub(1, 1) == j then
|
if k:sub(1, 1) == j then
|
||||||
@ -1685,7 +1677,10 @@ minetest.register_on_mods_loaded(function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
a_z = nil
|
end
|
||||||
|
|
||||||
|
minetest.register_on_mods_loaded(function()
|
||||||
|
factions.create_help_text()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
@ -12,28 +12,6 @@ factions.player_ips = factions.root.sub_database("ips")
|
|||||||
-- Memory only storage.
|
-- Memory only storage.
|
||||||
factions.onlineplayers = {}
|
factions.onlineplayers = {}
|
||||||
|
|
||||||
-- Table hook functions.
|
|
||||||
|
|
||||||
-- Hook function to add or delete from the faction table.
|
|
||||||
function factions.on_create_faction_table(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Hook function to add or delete from the ip table.
|
|
||||||
function factions.on_create_ip_table(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Hook function to add or delete from the player table.
|
|
||||||
function factions.on_create_player_table(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Hook function to add or delete from the claim table.
|
|
||||||
function factions.on_create_parcel_table(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Table creation.
|
-- Table creation.
|
||||||
|
|
||||||
-- Create a empty faction.
|
-- Create a empty faction.
|
||||||
@ -87,7 +65,7 @@ function factions.create_faction_table()
|
|||||||
--! @brief access table
|
--! @brief access table
|
||||||
access = {players = {}, factions = {}},
|
access = {players = {}, factions = {}},
|
||||||
}
|
}
|
||||||
return factions.on_create_faction_table(table)
|
return table
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create a empty ip table.
|
-- Create a empty ip table.
|
||||||
@ -95,7 +73,7 @@ function factions.create_ip_table()
|
|||||||
local table = {
|
local table = {
|
||||||
ip = ""
|
ip = ""
|
||||||
}
|
}
|
||||||
return factions.on_create_ip_table(table)
|
return table
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create a empty player table.
|
-- Create a empty player table.
|
||||||
@ -103,7 +81,7 @@ function factions.create_player_table()
|
|||||||
local table = {
|
local table = {
|
||||||
faction = ""
|
faction = ""
|
||||||
}
|
}
|
||||||
return factions.on_create_player_table(table)
|
return table
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create a empty claim table.
|
-- Create a empty claim table.
|
||||||
@ -111,7 +89,7 @@ function factions.create_parcel_table()
|
|||||||
local table = {
|
local table = {
|
||||||
faction = ""
|
faction = ""
|
||||||
}
|
}
|
||||||
return factions.on_create_parcel_table(table)
|
return table
|
||||||
end
|
end
|
||||||
|
|
||||||
-- helper functions
|
-- helper functions
|
||||||
|
3
mod.conf
3
mod.conf
@ -1,4 +1,3 @@
|
|||||||
name = factions
|
name = factions
|
||||||
description = Mod for handling in game factions and reputation.
|
description = Mc style faction system.
|
||||||
depends = colddb
|
depends = colddb
|
||||||
optional_depends = default, doors, xdecor, ts_doors
|
|
||||||
|
39
nodes.lua
39
nodes.lua
@ -12,8 +12,9 @@ function factions.can_use_node(pos, player, permission)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Make default chest the faction chest.
|
minetest.register_on_mods_loaded(function()
|
||||||
if minetest.registered_nodes["default:chest"] then
|
-- Make default chest the faction chest.
|
||||||
|
if minetest.registered_nodes["default:chest"] then
|
||||||
local dc = minetest.registered_nodes["default:chest"]
|
local dc = minetest.registered_nodes["default:chest"]
|
||||||
local def_on_rightclick = dc.on_rightclick
|
local def_on_rightclick = dc.on_rightclick
|
||||||
|
|
||||||
@ -104,47 +105,47 @@ if minetest.registered_nodes["default:chest"] then
|
|||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
on_rightclick = on_rightclick})
|
on_rightclick = on_rightclick})
|
||||||
end
|
end
|
||||||
|
|
||||||
local door_items = {"doors:door_wood", "doors:door_steel", "doors:door_glass", "doors:door_obsidian_glass", "doors:woodglass_door", "doors:slide_door",
|
local door_items = {"doors:door_wood", "doors:door_steel", "doors:door_glass", "doors:door_obsidian_glass", "doors:woodglass_door", "doors:slide_door",
|
||||||
"doors:screen_door", "doors:rusty_prison_door", "doors:prison_door", "doors:japanese_door", "ts_doors:door_default_aspen_wood", "ts_doors:door_full_default_aspen_wood",
|
"doors:screen_door", "doors:rusty_prison_door", "doors:prison_door", "doors:japanese_door", "ts_doors:door_default_aspen_wood", "ts_doors:door_full_default_aspen_wood",
|
||||||
"ts_doors:door_default_pine_wood", "ts_doors:door_full_default_pine_wood", "ts_doors:door_default_acacia_wood", "ts_doors:door_full_default_acacia_wood",
|
"ts_doors:door_default_pine_wood", "ts_doors:door_full_default_pine_wood", "ts_doors:door_default_acacia_wood", "ts_doors:door_full_default_acacia_wood",
|
||||||
"ts_doors:door_default_wood", "ts_doors:door_full_default_wood", "ts_doors:door_default_junglewood", "ts_doors:door_full_default_junglewood",
|
"ts_doors:door_default_wood", "ts_doors:door_full_default_wood", "ts_doors:door_default_junglewood", "ts_doors:door_full_default_junglewood",
|
||||||
"ts_doors:door_default_bronzeblock", "ts_doors:door_full_default_bronzeblock", "ts_doors:door_default_copperblock", "ts_doors:door_full_default_copperblock",
|
"ts_doors:door_default_bronzeblock", "ts_doors:door_full_default_bronzeblock", "ts_doors:door_default_copperblock", "ts_doors:door_full_default_copperblock",
|
||||||
"ts_doors:door_default_diamondblock", "ts_doors:door_full_default_diamondblock", "ts_doors:door_full_default_goldblock", "ts_doors:door_default_steelblock", "ts_doors:door_full_default_steelblock"}
|
"ts_doors:door_default_diamondblock", "ts_doors:door_full_default_diamondblock", "ts_doors:door_full_default_goldblock", "ts_doors:door_default_steelblock", "ts_doors:door_full_default_steelblock"}
|
||||||
|
|
||||||
local trapdoor_items = {"doors:trapdoor", "doors:trapdoor_steel", "ts_doors:trapdoor_default_aspen_wood", "ts_doors:trapdoor_full_default_aspen_wood",
|
local trapdoor_items = {"doors:trapdoor", "doors:trapdoor_steel", "ts_doors:trapdoor_default_aspen_wood", "ts_doors:trapdoor_full_default_aspen_wood",
|
||||||
"ts_doors:trapdoor_default_wood", "ts_doors:trapdoor_full_default_wood", "ts_doors:trapdoor_default_acacia_wood", "ts_doors:trapdoor_full_default_acacia_wood",
|
"ts_doors:trapdoor_default_wood", "ts_doors:trapdoor_full_default_wood", "ts_doors:trapdoor_default_acacia_wood", "ts_doors:trapdoor_full_default_acacia_wood",
|
||||||
"ts_doors:trapdoor_default_bronzeblock", "ts_doors:trapdoor_full_default_bronzeblock", "ts_doors:trapdoor_default_copperblock", "ts_doors:trapdoor_full_default_copperblock", "ts_doors:trapdoor_full_default_diamondblock",
|
"ts_doors:trapdoor_default_bronzeblock", "ts_doors:trapdoor_full_default_bronzeblock", "ts_doors:trapdoor_default_copperblock", "ts_doors:trapdoor_full_default_copperblock", "ts_doors:trapdoor_full_default_diamondblock",
|
||||||
"ts_doors:door_default_goldblock", "ts_doors:trapdoor_default_steelblock", "ts_doors:trapdoor_full_default_steelblock", "ts_doors:trapdoor_default_pine_wood", "ts_doors:trapdoor_full_default_pine_wood",
|
"ts_doors:door_default_goldblock", "ts_doors:trapdoor_default_steelblock", "ts_doors:trapdoor_full_default_steelblock", "ts_doors:trapdoor_default_pine_wood", "ts_doors:trapdoor_full_default_pine_wood",
|
||||||
"ts_doors:trapdoor_full_default_goldblock", "ts_doors:trapdoor_default_junglewood", "ts_doors:trapdoor_full_default_junglewood",
|
"ts_doors:trapdoor_full_default_goldblock", "ts_doors:trapdoor_default_junglewood", "ts_doors:trapdoor_full_default_junglewood",
|
||||||
"ts_doors:trapdoor_default_diamondblock", "ts_doors:trapdoor_default_goldblock"}
|
"ts_doors:trapdoor_default_diamondblock", "ts_doors:trapdoor_default_goldblock"}
|
||||||
|
|
||||||
-- Edit default doors and trapdoors to make them require the door permission.
|
-- Edit default doors and trapdoors to make them require the door permission.
|
||||||
local doors = {}
|
local doors = {}
|
||||||
|
|
||||||
local all_items = {}
|
local all_items = {}
|
||||||
|
|
||||||
local item_count = 1
|
local item_count = 1
|
||||||
|
|
||||||
local old_i = 0
|
local old_i = 0
|
||||||
|
|
||||||
for i, l in ipairs(door_items) do
|
for i, l in ipairs(door_items) do
|
||||||
doors[item_count] = l .. "_a"
|
doors[item_count] = l .. "_a"
|
||||||
doors[item_count + 1] = l .. "_b"
|
doors[item_count + 1] = l .. "_b"
|
||||||
all_items[i] = l
|
all_items[i] = l
|
||||||
item_count = item_count + 2
|
item_count = item_count + 2
|
||||||
old_i = old_i + 1
|
old_i = old_i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, l in ipairs(trapdoor_items) do
|
for i, l in ipairs(trapdoor_items) do
|
||||||
doors[item_count] = l
|
doors[item_count] = l
|
||||||
doors[item_count + 1] = l .. "_open"
|
doors[item_count + 1] = l .. "_open"
|
||||||
all_items[old_i + i] = l
|
all_items[old_i + i] = l
|
||||||
item_count = item_count + 2
|
item_count = item_count + 2
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, l in ipairs(doors) do
|
for i, l in ipairs(doors) do
|
||||||
local dw = minetest.registered_nodes[l]
|
local dw = minetest.registered_nodes[l]
|
||||||
if dw then
|
if dw then
|
||||||
local def_on_rightclick = dw.on_rightclick
|
local def_on_rightclick = dw.on_rightclick
|
||||||
@ -177,9 +178,9 @@ for i, l in ipairs(doors) do
|
|||||||
minetest.override_item(l, {on_rightclick = on_rightclick,
|
minetest.override_item(l, {on_rightclick = on_rightclick,
|
||||||
can_dig = can_dig})
|
can_dig = can_dig})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, l in ipairs(all_items) do
|
for i, l in ipairs(all_items) do
|
||||||
local it = minetest.registered_items[l]
|
local it = minetest.registered_items[l]
|
||||||
if it then
|
if it then
|
||||||
local def_on_place = it.on_place
|
local def_on_place = it.on_place
|
||||||
@ -200,7 +201,9 @@ for i, l in ipairs(all_items) do
|
|||||||
minetest.override_item(l, {on_place = on_place})
|
minetest.override_item(l, {on_place = on_place})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
-- Code below was copied from TenPlus1's protector mod(MIT) and changed up a bit.
|
-- Code below was copied from TenPlus1's protector mod(MIT) and changed up a bit.
|
||||||
|
|
||||||
local x = math.floor(factions_config.parcel_size / 2.1)
|
local x = math.floor(factions_config.parcel_size / 2.1)
|
||||||
|
Loading…
Reference in New Issue
Block a user