add biome notes to /docs, delete old chandelier files and add initial new chandelier. add ignore mod for player ignore in chat. edits to toolranks/modifiers, add new paitings

master
FreeGamers 2020-07-12 16:29:45 -05:00
parent 156b1f9ed1
commit f801321719
28 changed files with 776 additions and 177 deletions

View File

@ -0,0 +1,57 @@
Glasslands
Coniferous Forest
Deciduous Forest
Rainforest
Savanna
Desert
Sandstone Desert
Cold Desert
Snowy Grassland
Taiga
Tundra
Ice Sheet
Grassland Dunes
Coniferous Forest Dunes
Deciduous Forest Shore
Rainforest Swamp
Savanna Shore
Taiga beach
Tundra Beach
Tundra Ocean
Other Oceans
Undergroud Biome
pyramids
-- Set following to 1 to enable biome or false to disable
ethereal.glacier = 1 -- Ice glaciers with snow
ethereal.bamboo = 1 -- Bamboo with sprouts
ethereal.mesa = 1 -- Mesa red and orange clay with giant redwood
ethereal.alpine = 1 -- Snowy grass
ethereal.healing = 1 -- Snowy peaks with healing trees
ethereal.snowy = 1 -- Cold grass with pine trees and snow spots
ethereal.frost = 1 -- Blue dirt with blue/pink frost trees
ethereal.grassy = 1 -- Green grass with flowers and trees
ethereal.caves = 1 -- Desert stone ares with huge caverns underneath
ethereal.grayness = 1 -- Grey grass with willow trees
ethereal.grassytwo = 1 -- Sparse trees with old trees and flowers
ethereal.prairie = 1 -- Flowery grass with many plants and flowers
ethereal.jumble = 1 -- Green grass with trees and jungle grass
ethereal.junglee = 1 -- Jungle grass with tall jungle trees
ethereal.desert = 1 -- Desert sand with cactus
ethereal.grove = 1 -- Banana groves and ferns
ethereal.mushroom = 1 -- Purple grass with giant mushrooms
ethereal.sandstone = 1 -- Sandstone with smaller cactus
ethereal.quicksand = 1 -- Quicksand banks
ethereal.plains = 1 -- Dry dirt with scorched trees
ethereal.savannah = 1 -- Dry yellow grass with acacia tree's
ethereal.fiery = 1 -- Red grass with lava craters
ethereal.sandclay = 1 -- Sand areas with clay underneath
ethereal.swamp = 1 -- Swamp areas with vines on tree's, mushrooms, lilly's and clay sand
ethereal.sealife = 1 -- Enable coral and seaweed
ethereal.reefs = 1 -- Enable new coral reefs in default
ethereal.sakura = 1 -- Enable sakura biomes with trees

View File

@ -0,0 +1,26 @@
DIMENSION MAXIMUM MINIMUM SIZE
OW RedAsteroids 22001 - 30912 8000
Planet_Mars 11000 - 22000 11000
OW Asteroids (Moon) 3500 - 10999 7500
Planet_Moon 3000 - 3300 300
Earth Orbital Space 1000 - 2999 2000
Cloudlands 200
SURFACE
GeoMoria -140 - -170 30
tsm_railcorridors -180 - -9500 (9500)
Cave Realms -180 - -16000
DF-Level1-UpperLimit -500 - -3500 3000
DF-Level2-UpperLimit -3500 - -6500 3000
DF-Level3-UpperLimit -6500 - -9500 3000
CaveRealms - Dungeon Master -6500 - -9500 3000
DF-SunlessSea -9500 - -11000 1500
DF-OilSea -11,500 500
DF-LavaSea -12,000 500
DF-Underworld -12,500 500
//DF-Primordial -13000 - -16000 3000
Nether(Hell) -16,500 - -30,000 14500
Bedrock -30,000 - -30,192 ~1000

View File

@ -12,7 +12,6 @@ fridges aren't protected.
################################## HIGHER PRIORITY ##################################
add coins (plat, gold, silver, copper) as drops from mobs. NPCs can trade in these coins.
change blueberry respawn rate
Add more toolranks levels
Make ovens compatible with other food items.
After crops is implemented, rain ABM's can grow crops and grass, wash out footprints.
Add weeds to crops (use nettles and ABM)
@ -42,4 +41,7 @@ Implement stargate-like portal with nether portal_api?
RPG Skills mechanics like McMMO?
Terraria-like Pet spawners (e.g. dog whistle)?
Mining helmet, spawn wielded light above player when wearing.
leather more uses for leather: armor, maybe canteen.
leather more uses for leather: armor, maybe canteen.
UNSORTED
-- Improve wolf/dog following code.

View File

@ -650,27 +650,63 @@ end
-----------------
-- Chandelier
-----------------
minetest.register_node("candles:chandelier_bronze", {
description = "Bronze Chandelier",
drawtype = "mesh",
mesh = "candles_chandelier.obj",
tiles = {"candles_chandelier_bronze.png",
"candles_candle_bronze_bottom.png^[multiply:#DFDFDF"},
collision_box = {
type = "fixed",
fixed = {-3/8, -1/2, -3/8, 3/8, 1/2, 3/8}
},
selection_box = {
type = "fixed",
fixed = {-3/8, -1/2, -3/8, 3/8, 1/2, 3/8}
},
paramtype = "light",
light_source = 10,
groups = {cracky = 2, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
minetest.register_node("candles:gold_chandelier", {
description = "Gold Chandelier",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
tiles = {{
name = "candles_gold_chandelier_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.5
}
}},
wield_image = "candles_gold_chandelier.png",
inventory_image = "candles_gold_chandelier.png",
selection_box = {
type = "fixed",
fixed = {-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}
},
walkable = false,
groups = {dig_immediate = 2},
light_source = 10,
groups = {cracky = 2, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("candles:gold_chandelier_unlit", {
description = "Unlit Gold Chandelier",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
tiles = {"candles_gold_chandelier_unlit.png"},
selection_box = {
type = "fixed",
fixed = {-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}
},
walkable = false,
groups = {dig_immediate = 2}
})
minetest.register_craft({
output = "candles:gold_chandelier",
recipe = {
{"", "default:gold_ingot", ""},
{"default:torch", "default:gold_ingot", "default:torch"}
}
})
minetest.register_craft({
output = "candles:gold_chandelier_unlit",
recipe = {
{"candles:candle", "default:gold_ingot", "candles:candle"},
{"", "default:gold_ingot", ""},
{"candles:candle", "", "candles:candle"}
}
})
------------------
-- Craft Recipes
@ -690,13 +726,3 @@ minetest.register_craft({
{"bees:wax", "farming:cotton", "bees:wax"},
}
})
-- This one needs some work still so lets not make it craftable yet.
-- TODO: add candles.
--minetest.register_craft({
-- output = "candles:chandelier_bronze",
-- recipe = {
-- {"candles:candle", "default:bronze_ingot", "candles:candle"},
-- {"candles:candle", "default:bronze_ingot", "candles:candle"},
-- {"default:steel_ingot", "default:bronze_ingot", "default:steel_ingot"}
-- }
--})

View File

@ -1,79 +0,0 @@
# Blender v2.79 (sub 0) OBJ File: 'vintage_chandelier.blend'
# www.blender.org
o Plane.001_Plane.005
v 0.250000 -0.500000 -0.433013
v -0.250000 -0.500000 0.433013
v 0.250000 0.500000 -0.433013
v -0.250000 0.500000 0.433013
v -0.250000 -0.500000 -0.433013
v 0.250000 -0.500000 0.433013
v -0.250000 0.500000 -0.433013
v 0.250000 0.500000 0.433013
v 0.500000 -0.500000 0.000000
v -0.500000 -0.500000 0.000000
v 0.500000 0.500000 -0.000000
v -0.500000 0.500000 0.000000
v 0.000000 -0.500000 0.000000
v -0.000000 0.500000 -0.000000
vt 0.000000 0.000000
vt 0.500000 0.000000
vt 0.500000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vn -0.8660 -0.0000 -0.5000
vn -0.8660 -0.0000 0.5000
vn -0.0000 -0.0000 -1.0000
g Plane.001_Plane.005_Material.001
s off
f 1/1/1 13/2/1 14/3/1 3/4/1
f 5/5/2 13/2/2 14/3/2 7/6/2
f 9/7/3 13/2/3 14/3/3 11/8/3
f 14/3/1 13/2/1 2/9/1 4/10/1
f 14/3/2 13/2/2 6/11/2 8/12/2
f 14/3/3 13/2/3 10/13/3 12/14/3
o Cube
v 0.031250 -0.375000 -0.031250
v 0.031250 -0.375000 0.031250
v -0.031250 -0.375000 0.031250
v -0.031250 -0.375000 -0.031250
v 0.031250 0.500000 -0.031250
v 0.031250 0.500000 0.031250
v -0.031250 0.500000 0.031250
v -0.031250 0.500000 -0.031250
vt 0.437500 0.062500
vt 0.375000 0.062500
vt 0.375000 0.000000
vt 0.437500 0.000000
vt 0.437500 0.937500
vt 0.437500 1.000000
vt 0.375000 1.000000
vt 0.375000 0.937500
vt 0.625000 0.062500
vt 0.625000 0.937500
vt 0.562500 0.937500
vt 0.562500 0.062500
vt 0.500000 0.937500
vt 0.500000 0.062500
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
g Cube_Cube_Material
s off
f 15/15/4 16/16/4 17/17/4 18/18/4
f 19/19/5 22/20/5 21/21/5 20/22/5
f 15/15/6 19/19/6 20/22/6 16/16/6
f 16/23/7 20/24/7 21/25/7 17/26/7
f 17/26/8 21/25/8 22/27/8 18/28/8
f 19/19/9 15/15/9 18/28/9 22/27/9

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

4
mods/ignore/README.md Normal file
View File

@ -0,0 +1,4 @@
# Ignore mod for [Minetest](https://minetest.net)
This mod allows you to manage your own ignore list.
It also tries to overcome the blocking callback mechanism of Minetest.

155
mods/ignore/api.md Normal file
View File

@ -0,0 +1,155 @@
Ignore mod by Mg
================
# API Documentation
## 0°) Namespaces
Ignore uses a few namespaces to organize its data. Here is a diagram explaining them :
ignore <- main namespace
|
+ lists <- all the players' ignore lists (see part 1)
| |
| + data <- the players' data
| | |
| | + foo <- player foo's ignore list
| | + bar <- player bar's ignore list
| | + ...
| |
| |
| + get_list <- basic api methods (lists, etc...)
| + get_ignore_names <- for all of them see part 1
| + set_list
| + del_list
| + init_list
| + get_ignore
| + add
| + del
| + save
| + load
|
+ queue <- the entire queues, data and methods (see part 2)
| |
| + data <- queues data
| | |
| | + save <- 'save' type queue's data
| | + ...
| |
| + add <- add method
| + workall <- workall method
| + work <- work method
| + flush <- flush method
|
+ callback <- ignore's callback (see part 3)
+ config <- configuration values (see part 5)
|
+ save_dir
+ enabled
+ queue_interval
## 1°) Lists
Lists are the basic containers of ignore data. Multiple methods are provided to manage, create, save and load lists. All lists are loaded in `ignore.lists[playername]` as a dictionary. The dictionary's key is the ignored player's name, and its value is the time stamp indicating the moment they were ignored.
Those methods come in `lists.lua` :
- `ignore.get_list` :
- 1 parameter : name (string)
- returns the player's entry in `ignore.`
- `ignore.get_ignore_names` :
- 1 parameter : name (string)
- returns a list of names the player is ignoring (mostly for size purposes)
- `ignore.set_list(name, list)`
- 2 parameters : name (string), list (dictionary of strings,timestamps)
- sets name's ignore list to list
- `ignore.del_list(name)`
- 1 parameter : name (string)
- unloads name's list from the loaded lists
- `ignore.init_list(name)`
- 1 parameter : name (string)
- resets name's ignore list to an empty dictionary. Creates it if it doesn't exist
- `ignore.get_ignore(ignored, name)`
- 2 parameters : ignored (string), name (string)
- returns name's entry about ignored, whether or not it exists. Tries to load names' ignore list, and return the error string given by `io.open`, returned by `ignore.load`, along with the value false, and creates an empty list for the player when it fails to load it.
- `ignore.add(ignored, name)`
- 2 parameters : ignored (string), name (string)
- adds `ignored` to name's list, or warn if they're already ignored ('dejavu' return code)
- if the player `ignored` is protected by `ignore_protection`, return false and the 'protected' code
- `ignore.del(ignored, name)`
- 2 parameters : ignored (string), name (string)
- removes ignored from name's list, or warn if they're not being ignored ('notignored' return code)
- `ignore.save`
- 1 parameter : name (string)
- saves name's list in ignore's configured save directory (under name's name)
- `ignore.load`
- 1 parameter : name (string)
- loads name's list from their file in ignore's configured save directory
- it is used before anyone with an empty ignore list uses `/ignore`
## 2°) Queue
Ignore uses queues to delay actions such as saving. Here is how to use them.
These methods come from `queues.lua`:
- `ignore.queue.add`
- 1 parameter : action (dictionary)
- enqueues an action in the 'action.type' queue
- currently supported types :
- save : saving files (parameters : target (string))
- if no type is provided, error code 'notype' returned
- if an action of the same type and parameters is already queue, returns code 'dejavu'
- `ignore.queue.workall`
- no parameters
- does one action in each filled queue
- `ignore.queue.work`
- 1 parameter : queuetype (string)
- does one action in queue of type queuetype. If it doesn't exist, return error code 'nosuchqueue'. If it is empty, returns 'emptyqueue'
- the error code 'noarget' alerts about the missing 'target' parameter on types like 'save'
- `ignore.queue.flush`
- no parameters
- flushes all queues, doing all queued work until everything is empty
- hooked by default to `minetest.register_on_shutdown`
## 3°) The callback
Ignore's callback is located inside `callback.lua`. It is by default hooked to `minetest.register_on_chat_message`. It does all the engine's work while filtering according to ignore lists.
The same file also contains an override of /me to block ignored user's actions.
## 4°) The chatcommand and privilege
Ignore's chatcommand, the users' basic interface, is implemented in `chatcommand.lua`, along with the definition of the `ignore_protection` privilege. A configuration key can allow you to disable this file, making ignore pointless. The chat command currently handles 5 subcommands :
- `add` :
- 1 parameter needed : the player's name
- adds the player to the invoker's ignore list if the player isn't protected with the `ignore_protection` privilege, or warn them if they are already ignored
- note : `add` can be replaced by `+`
- `del` :
- 1 parameter needed : the ignored player's name
- removes the player from the invoker's ignore list, or warn them if they were not being ignored
- note : `del` can be replaced by `-`
- `help` :
- no parameters needed
- shows the basic help for the 5 subcommands
- `show` :
- no parameters needed
- shows to the invoker their ignore list, or tell them if it is currently empty
- `init` :
- no parameters needed
- resets the invoker's ignore list to an empty dictionary
- `check` :
- 1 parameter needed : a player's name
- tells you whether or not player `name` is ignoring you
Note : players need the `shout` privilege to use `/ignore`.
## 5°) Configuration keys
Ignore uses some configuration keys as variable values :
- `ignore.config.save_dir` :
- directory in which are saved all ignore files
- defaults to `minetest.get_worldpath() .. '/ignore'`
- `ignore.config.enabled` :
- indicates whether or not to load the callback
- is the opposite value of the key `disable_ignore` in `minetest.conf`
- defautls to `true`
- `ignore.queue_interval` :
- interval between two collective queue works (`ignore.queue.workall` calls) in seconds
- from the key `ignore_queue_interval` in `minetest.conf`
- defaults to 30 seconds

73
mods/ignore/callback.lua Normal file
View File

@ -0,0 +1,73 @@
--[[
Part of the ignore mod
Last Modification: 01/18/16 @ 9:01PM UTC+1
This file contains the ignore callback
--]]
function ignore.callback(sender, message)
-- 1) The engine's job
-- Invalid command handler (which should be in the builtin btw)
if message == "/" then
minetest.chat_send_player(sender, "-!- Empty command")
return true
end
local cmd, _ = message:match("^/([^ ]+) *(.*)")
if cmd and not core.chatcommands[cmd] then
minetest.chat_send_player(sender, "-!- Invalid command: " .. cmd)
return true
elseif not minetest.check_player_privs(sender, {shout = true}) then
minetest.chat_send_player(sender, "-!- You don't have permission to shout.")
return true
end
-- Normal log handler
minetest.log("action", ("CHAT: <%s> %s"):format(sender, message))
-- Execute other callbacks (remember we don't want to block them)
-- First, identify our range in the callback table
local index = 0
for i, func in pairs(core.registered_on_chat_messages) do
if func == ignore.callback then
index = i
break
end
end
for i = index+1, table.getn(core.registered_on_chat_messages) do
if (not minetest.global_exists("chatdam") or core.registered_on_chat_messages[i] ~= chatdam.floodcontrol) then
local ret = core.registered_on_chat_messages[i](sender, message)
if ret then
-- If other mods decide to block callbacks that's their choice
break
end
end
end
-- Finally, send and sort according to ignores
for k, ref in pairs(minetest.get_connected_players()) do
local receiver = ref:get_player_name()
local vtable = minetest.get_version().string:split('-')[1]:split('.')
if (receiver ~= sender or (tonumber(vtable[1]) > 0 or tonumber(vtable[2]) > 4 or tonumber(vtable[3]) >= 15)) and not ignore.get_ignore(sender, receiver) then
-- Small note :
-- In VERSION < 0.4.16, a client would see their own message in chat before the server acknowledged them, so the server wouldn't send it to them, and we didn't either
-- In VERSION >= 0.4.16, a client would receive the server packet indicating a chat message before showing even the player's own message : we need to send them
minetest.chat_send_player(receiver, ("<%s> %s"):format(sender, message))
end
end
return true -- Tell the engine we did its job
end
minetest.register_on_chat_message(ignore.callback)
-- Override on /me
local old_me_callback = core.chatcommands["me"].func
core.chatcommands["me"].func = function(name, param)
for _, p in pairs(minetest.get_connected_players()) do
if not ignore.get_ignore(name, p:get_player_name()) then
minetest.chat_send_player(p:get_player_name(), ("* %s %s"):format(name, param))
end
end
end

102
mods/ignore/chatcommand.lua Normal file
View File

@ -0,0 +1,102 @@
--[[
Part of the ignore mod
Last Modification : 01/18/16 @ 9:03PM UTC+1
This file contains the ignore chatcommand
And also, the ignore_protection privilege
--]]
minetest.register_privilege("ignore_protection", {
description = "Players with this privilege cannot be ignored",
give_to_singleplayer = false,
give_to_admin = true,
})
minetest.register_chatcommand("ignore", {
description = "Manage ignore list",
params = "<add | del | show | init | check | <help> [<name>]",
privs = {shout = true},
func = function(name, param)
if not ignore.get_list(name) then
ignore.load(name)
end
if param == "" then
return false, "Use '/help ignore' or '/ignore help' to show ignore's help"
end
local params = param:split(" ")
local cmd = params[1]
if cmd == "help" then
return true, "Ignore's help : \n" ..
"- /ignore help : Show this help\n" ..
"- /ignore add name : Add name in your ignore list\n" ..
"- /ignore del name : Remove name from your ignore list\n" ..
"- /ignore show : Print your entire ignore list\n" ..
"- /ignore init : Reset your ignore list\n" ..
"- /ignore check name : Checks whether or not player 'name' is ignoring you"
elseif cmd == "add" or cmd == "+" then
if not params[2] then
return false, "Ignore's add subcommand needs a parameter : the player's name"
end
local res, code = ignore.add(params[2], name)
if res then
ignore.queue.add({type = "save", target = name})
return true, "Successfully added " .. params[2] .. " to your ignore list"
elseif code == "dejavu" then
return true, params[2] .. " is already in your ignore list"
elseif code == "protected" then
return true, params[2] .. " is protected. You cannot ignore them"
end
elseif cmd == "del" or cmd == "-" then
if not params[2] then
return false, "Ignore's del subcommand needs a parameter : the player's name"
end
local res = ignore.del(params[2], name)
if res then
ignore.queue.add({type = "save", target = name})
return true, "Successfully removed " .. params[2] .. " from your ignore list"
else
return true, params[2] .. " is not in your ignore list"
end
elseif cmd == "show" then
if not ignore.get_list(name) or table.getn(ignore.get_ignore_names(name)) == 0 then
return true, "Your ignore list is currently empty"
end
local res = "Your ignore list :"
for name, time in pairs(ignore.get_list(name)) do
res = res .. "\n- " .. name .. " : ignored on " .. os.date("%m/%d/%Y at %r", time)
end
return true, res
elseif cmd == "init" then
ignore.init_list(name)
ignore.queue.add({type = "save", target = name})
return true, "Successfully reset your ignore list"
elseif cmd == "check" then
if not params[2] then
return false, "Please provide a player's name"
end
local res, code = ignore.get_ignore(name, params[2])
if res then
return true, "Player " .. params[2] .. " is ignoring you"
elseif not code then
return true, "You are not on " .. params[2] .. "'s ignore list"
else
return true, "This player doesn't appear to have any ignore list"
end
else
return false, "Unknown subcommand " .. cmd .. ". See '/help ignore' or '/ignore help' for help on this command"
end
end
})

38
mods/ignore/init.lua Normal file
View File

@ -0,0 +1,38 @@
--[[
Ignore
A Minetest mod to manage ignore lists
Code by: Mg
Version: 00.01.18
License: WTFPL
Last Modification: 01/18/16 @ 9:31PM UTC+1
]]--
-- Da namespace
ignore = {}
ignore.config = {}
ignore.config.save_dir = minetest.get_worldpath() .. "/ignore"
ignore.config.enabled = not(minetest.settings:get_bool("disable_ignore") or false)
ignore.config.queue_interval = tonumber(minetest.settings:get("ignore_queue_interval")) or 30
dofile(minetest.get_modpath("ignore") .. "/lists.lua")
dofile(minetest.get_modpath("ignore") .. "/queues.lua")
dofile(minetest.get_modpath("ignore") .. "/chatcommand.lua")
minetest.mkdir(ignore.config.save_dir)
if ignore.config.enabled then
minetest.log("action", "[Ignore] This session is loaded with the ignore callback")
dofile(minetest.get_modpath("ignore") .. "/callback.lua")
else
minetest.log("action", "[Ignore] This session is loaded without the ignore callback")
end
minetest.register_on_leaveplayer(function(player)
ignore.del_list(player:get_player_name())
end)

141
mods/ignore/lists.lua Normal file
View File

@ -0,0 +1,141 @@
-- Part of the ignore mod
-- Last Modification : 01/18/16 @ 9:00PM UTC+1
-- This file contains all methods/namespaces for loading/saving/managing lists
--
ignore.lists = {}
ignore.lists.data = {}
function ignore.get_list(name)
return ignore.lists.data[name]
end
function ignore.get_ignore_names(name)
if not ignore.lists.data[name] then
return {}
end
local tab = {}
for n, _ in pairs(ignore.lists.data[name]) do
table.insert(tab, n)
end
return tab
end
function ignore.set_list(name, list)
ignore.lists.data[name] = list
minetest.log("action", "[Ignore] Set list of player " .. name)
return true
end
function ignore.del_list(name)
ignore.lists.data[name] = nil
minetest.log("action", "[Ignore] Deleted list of player " .. name)
return true
end
function ignore.init_list(name)
ignore.lists.data[name] = {}
minetest.log("action", "[Ignore] Init on list for player " .. name)
return true
end
function ignore.get_ignore(ignored, name)
if not ignore.lists.data[name] then
local res, code = ignore.load(name)
if not res and code then
return false, code
else
return ignore.get_ignore(ignored, name)
end
end
return ignore.lists.data[name][ignored]
end
function ignore.add(ignored, name)
if not ignore.lists.data[name] then
ignore.init_list(name)
return ignore.add(ignored, name)
-- ^ Crooked
end
if ignore.get_ignore(ignored, name) then
minetest.log("action", "[Ignore] Will not add " .. ignored .. " in list of player " .. name .. " : already present")
return false, "dejavu"
elseif minetest.get_player_privs(ignored).ignore_protection then
minetest.log("action", "[Ignore] Will not add " .. ignored .. " in list of player " .. name .. " : player protected")
return false, "protected"
end
ignore.lists.data[name][ignored] = os.time()
minetest.log("action", "[Ignore] Adding " .. ignored .. " in " .. name .. "'s list")
return true
end
function ignore.del(ignored, name)
if not ignore.lists.data[name] then
minetest.log("action", "[Ignore] Will not remove " .. ignored .. " from " .. name .. "'s list : no ignore list")
return false, "nolist"
end
local status = ignore.get_ignore(ignored, name)
if not status then
minetest.log("action", "[Ignore] Couldn't remove " .. ignored .. " from " .. name .. "'s list : not currently ignored")
return false, "notignored"
else
minetest.log("action", "[Ignore] Successfully removed " .. ignored .. " from " .. name .. "'s list")
ignore.lists.data[name][ignored] = nil
return true
end
end
function ignore.save(name)
if not ignore.lists.data[name] then
minetest.log("action", "[Ignore] Saving list of " .. name .. " : inexistant list")
ignore.init_list(name)
end
local f, err = io.open(ignore.config.save_dir .. "/" .. name, 'w')
if not f then
minetest.log("error", "[Ignore] Failed to save " .. name .. "'s list : " .. err)
return false, err
end
for ignored, timestamp in pairs(ignore.lists.data[name]) do
f:write(("%s %s\n"):format(ignored, timestamp))
end
f:close()
minetest.log("action", "[Ignore] Ignore list saved for " .. name)
return true
end
function ignore.load(name)
ignore.init_list(name)
local f, err = io.open(ignore.config.save_dir .. "/" .. name)
if not f then
minetest.log("error", "[Ignore] Failed to load " .. name .. "'s list : " .. err)
return false, err
end
for line in f:lines() do
local ignored, timestamp
ignored = line:split(" ")[1]
timestamp = line:split(" ")[2]
if not ignored or not timestamp then
f:close()
minetest.log("error", "[Ignore] Error reading " .. name .. "'s list : corrupted file")
minetest.chat_send_player(name, "Error: Your file might be corrupted")
return false, line
end
ignore.lists.data[name][ignored] = timestamp
end
minetest.log("action", "Successfully logged " .. name .. "'s file")
f:close()
return true
end

3
mods/ignore/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = ignore
optional_depends = chatdam
description = Allows you to manage your own ignore list.

90
mods/ignore/queues.lua Normal file
View File

@ -0,0 +1,90 @@
--[[
Part of the Ignore mod
Last Modification : 01/18/16 @ 9:09PM UTC+1
This file contains all methods/namespaces to manage the queue
--]]
ignore.queue = {}
ignore.queue.data = {}
function ignore.queue.add(action)
if not action.type then
minetest.log("error", "[Ignore] Tried to register action without a type")
return false, "notype"
end
for _, a in pairs(ignore.queue.data) do
if a == action then
minetest.log("action", "[Ignore] Will not enqueue same action of type " .. action.type)
return false, "dejavu"
end
end
if not ignore.queue.data[action.type] then
ignore.queue.data[action.type] = {}
end
table.insert(ignore.queue.data[action.type], action)
minetest.log("action", "[Ignore] Enqueued action of type " .. action.type .. " (queue size : " .. #ignore.queue.data[action.type] .. ")")
return true
end
function ignore.queue.workall()
for ty, _ in pairs(ignore.queue.data) do
ignore.queue.work(ty)
end
end
function ignore.queue.work(queuetype)
if not ignore.queue.data[queuetype] then
minetest.log("error", "[Ignore] No such queue to work on : " .. queuetype)
return false, "nosuchqueue"
end
if table.getn(ignore.queue.data[queuetype]) == 0 then
return false, "emptyqueue"
end
local action = ignore.queue.data[queuetype][1] -- front
table.remove(ignore.queue.data[queuetype], 1) -- pop
--[[if not action.type then
minetest.log("error", "[Ignore] Invalid action treated")
return false, "notype"
end]]
if action.type == "save" then
if not action.target then
minetest.log("action", "[Ignore] Save action with no target")
return false, "notarget"
else
local res, err = ignore.save(action.target)
if not res then
minetest.log("error", "[Ignore] In 'save' type queue action : " .. err or "unidentified error")
end
end
end
minetest.log("action", "[Ignore] Successfully treated 1 item in queue of type " .. queuetype)
return true
end
function ignore.queue.flush()
for ty, _ in pairs(ignore.queue.data) do
while #(ignore.queue.data[ty] or {}) > 0 do
ignore.queue.work(ty)
end
minetest.log("action", "[Ignore] Queue of type " .. ty .. " emptied")
end
minetest.log("action", "[Ignore] Queues flushed")
return true
end
local function tick()
ignore.queue.workall()
minetest.after(ignore.config.queue_interval, tick)
end
minetest.after(0, tick)
minetest.register_on_shutdown(ignore.queue.flush)

View File

@ -1,22 +1,13 @@
-- declare our table
lib_trm = {}
lib_trm.name = "lib_trm"
lib_trm.ver_max = 0
lib_trm.ver_min = 1
lib_trm.ver_rev = 0
lib_trm.ver_str = lib_trm.ver_max .. "." .. lib_trm.ver_min .. "." .. lib_trm.ver_rev
lib_trm.authorship = "lisacvuk, davidthecreator, shadmordre"
lib_trm.license = "LGLv2.1"
lib_trm.copyright = "2019"
lib_trm.path_mod = minetest.get_modpath(minetest.get_current_modname())
lib_trm.path_world = minetest.get_worldpath()
-- execute the tool random modifiers.
dofile(lib_trm.path_mod.."/lib_trm_toolcap_modifier.lua")
-- execute the tool ranks portion.
dofile(lib_trm.path_mod.."/lib_trm_tool_ranks.lua")
minetest.register_on_mods_loaded(function()
for node_name, node_def in pairs(minetest.registered_tools) do
if node_name and node_name ~= "" then
@ -33,31 +24,4 @@ lib_trm.path_world = minetest.get_worldpath()
end
end
end
end)
end)

View File

@ -1,14 +1,13 @@
local mod_storage = minetest.get_mod_storage()
-- if toolranks mod is detected, don't use this module.
if minetest.get_modpath("toolranks") then
return
else
toolranks = {}
end
--toolranks = {}
-- color table with variables for quick reference.
toolranks.colors = {
grey = minetest.get_color_escape_sequence("#9d9d9d"),
green = minetest.get_color_escape_sequence("#1eff00"),
@ -16,6 +15,7 @@ toolranks.colors = {
white = minetest.get_color_escape_sequence("#ffffff")
}
-- function to determine tool types.
function toolranks.get_tool_type(description)
if string.find(description, "Pickaxe") then
return "pickaxe"
@ -30,34 +30,29 @@ function toolranks.get_tool_type(description)
end
end
-- function to create our description of the too (name, uses, and level)
function toolranks.create_description(name, uses, level)
local description = name
local tooltype = toolranks.get_tool_type(description)
local newdesc = toolranks.colors.green .. description .. "\n" ..
toolranks.colors.gold .. "Level " .. (level or 1) .. " " .. tooltype .. "\n" ..
toolranks.colors.grey .. "Nodes dug: " .. (uses or 0) -- .. "\n" ..
toolranks.colors.grey .. "Uses: " .. (uses or 0) -- .. "\n" ..
-- name
return newdesc
end
-- function to calculate levels (+150 uses per level).
function toolranks.get_level(uses)
if uses <= 200 then
if uses < 150 then
return 1
elseif uses < 400 then
return 2
elseif uses < 1000 then
return 3
elseif uses < 2000 then
return 4
elseif uses < 3200 then
return 5
else
return 6
return math.floor((75 + math.sqrt(625 + 100 * uses))/100)
end
end
-- function to run after a tool is used.
function toolranks.new_afteruse(itemstack, user, node, digparams)
local itemmeta = itemstack:get_meta() -- Metadata
@ -105,28 +100,29 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
itemmeta:set_string("dug", dugnodes)
end
-- if statement to track and broadcast the most used tool in the game.
if(dugnodes > most_digs) then
-- set the high score amount and player name.
most_digs = dugnodes
if(most_digs_user ~= user:get_player_name()) then -- Avoid spam.
most_digs_user = user:get_player_name()
minetest.chat_send_all("Most used tool is now a " .. t_name .. toolranks.colors.white .. " owned by " .. user:get_player_name() .. " with " .. dugnodes .. " uses.")
-- broadcast the message.
minetest.chat_send_all("The most used tool is now a " .. t_name .. toolranks.colors.white .. " owned by " .. user:get_player_name() .. " with " .. dugnodes .. " uses.")
end
-- utilize storage for these variables to track between game-session.
mod_storage:set_int("most_digs", dugnodes)
mod_storage:set_string("most_digs_user", user:get_player_name())
end
-- Tool break warning.
if(itemstack:get_wear() > 60135) then
minetest.chat_send_player(user:get_player_name(), "Your tool is about to break!")
minetest.sound_play("default_tool_breaks", {to_player = user:get_player_name(), gain = 2.0, })
end
-- Tool Level up event.
local level = toolranks.get_level(dugnodes)
if lastlevel < level then
@ -139,7 +135,7 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
itemmeta:set_string("lastlevel", level)
end
-- set tool description
local newdesc = ""
if t_stat ~= "" then
@ -149,15 +145,13 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
end
itemmeta:set_string("description", newdesc)
-- set tool wear
-- does this control the wearing effects?
local wear = digparams.wear
if level > 1 then
wear = digparams.wear / (1 + level / 4)
wear = digparams.wear / (1 + level / 10)
end
--minetest.chat_send_all("wear="..wear.."Original wear: "..digparams.wear.." 1+level/4="..1+level/4)
-- Uncomment for testing ^
itemstack:add_wear(wear)
return itemstack

View File

@ -1,5 +1,4 @@
minetest.register_on_craft(function(itemstack, tool_capabilities, player, old_craft_grid, craft_inv)
if itemstack:get_definition().tool_capabilities ~= nil then
itm_mt = itemstack:get_meta()

4
mods/lib_trm/readme.txt Normal file
View File

@ -0,0 +1,4 @@
lib_trm.authorship = "lisacvuk, davidthecreator, shadmordre"
lib_trm.license = "LGLv2.1"
lib_trm.copyright = "2019"

View File

@ -242,7 +242,7 @@ mobs:register_mob("mobs_creatures:dog", {
teleport_check_interval = 2
end
if not dist then
dist = 12
dist = 8
end
if self._teleport_timer == nil then
self._teleport_timer = teleport_check_interval

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 22 KiB