Update Todo, remove mp and magic potions

This commit is contained in:
ExeVirus 2021-09-16 19:35:42 -04:00
parent 5d9bf83619
commit cd3b4e5e9a
32 changed files with 5 additions and 559 deletions

View File

@ -14,4 +14,8 @@
12. Make some items dependent on Nether or Dragon kills (glider, etc.)
13. Update Licenses
14. Update Screenshot and main menu
15. Hot air Balloon fire particle needs to have the current balloon velocity, rather than still
15. Hot air Balloon fire particle needs to have the current balloon velocity, rather than still
16. Update i3 with doc_helper tab
17. Mob documentation: living nether, dmobs, default?
18. Mesecons Documentation
19. Make the maps rename-able

View File

@ -1,70 +0,0 @@
# Magic Potions (`magic_potions`)
Magic potions which grant the player temporary effects.
## About
Depends on the latest [`modlib`](https://github.com/appgurueu/modlib) and [`hud_timers`](https://github.com/appgurueu/hud_timers).
Code licensed under the MIT license. Media license is CC0. Written by Lars Mueller alias LMD or appguru(eu).
## Links
* [GitHub](https://github.com/appgurueu/magic_potions) - sources, issue tracking, contributing
* [Discord](https://discordapp.com/invite/ysP74by) - discussion, chatting
* [Minetest Forum](https://forum.minetest.net/viewtopic.php?f=9&t=24208) - (more organized) discussion
* [ContentDB](https://content.minetest.net/packages/LMD/magic_potions/) - releases (cloning from GitHub is recommended)
## Screenshots
![Screenshot](screenshot.png)
## Setup
Install the mod like any other, using `git clone https://github.com/appgurueu/magic_potions.git` or installing via ContentDB & the in-game content manager. Enable it, `modlib` & `hud_timers` and you're ready to enjoy some potions!
## Features
There are 3 levels of strength, from minor (weak) over ordinary (medium) to strong (best).
5 different potion types provide flying (antigravity), jumping (higher), (running) speed, healing (regeneration) and air (breathing, breath regen).
This makes for a total of 15 colorful potions. All effects are lost on death, and you can only use 3 at a time. They all have limited durations.
## Configuration
### Locations
JSON Configuration: `<worldpath>/config/magic_potions.json`
Text Logs (none): `<worldpath>/logs/magic_potions/<date>.json`
Readme (this): `<modpath/gamepath>/magic_potions/Readme.md`
### Default Configuration
Located under `<modpath/gamepath>/magic_potions/default_config.json`
```json
{
"tiers": {
"minor": 3,
"ordinary": 5,
"strong": 7
},
"max_in_use": 3
}
```
### Settings
#### `tiers`
Key-value lookup, keys are tier names (`"minor"`, `"ordinary"` and `"strong"`) and values are strength (number > 0 and <= 7)
#### `max_in_use`
How many potions can be used at a time. Number > 0 and < 10.
## API
Mostly self-documenting code. Mod namespace is `magic_potions`, containing all variables & functions.

View File

@ -1,8 +0,0 @@
{
"tiers": {
"minor": 3,
"ordinary": 5,
"strong": 7
},
"max_in_use": 3
}

View File

@ -1 +0,0 @@
modlib.mod.init()

View File

@ -1,241 +0,0 @@
local magic_potions = getfenv(1)
players = {}
minetest.register_on_joinplayer(function(player)
players[player:get_player_name()] = {in_use = 0, timers={}}
end)
config = modlib.conf.import(
"magic_potions",
{
type = "table",
children = {
tiers = {
keys = {
type = "string"
},
values = {
type = "number",
range = {0, 7},
int = true
}
},
max_in_use = {
type = "number",
range = {0, 10}
}
}
}
)
modlib.table.add_all(magic_potions, config)
function register_potion(potion_def)
for tier, tier_def in pairs(tiers) do
local def = {}
local effect = potion_def.effect(tier_def)
def.on_use = function(stack, player)
local player_data = players[player:get_player_name()]
local player_in_use = player_data.in_use
if player_in_use == max_in_use then
minetest.chat_send_player(
player:get_player_name(),
minetest.get_color_escape_sequence("#FF0000") ..
"You can only use " .. max_in_use .. " potions at a time!"
)
return
end
player_data.in_use = player_in_use + 1
local gain = effect(player)
local timer = hud_timers.add_timer(
player:get_player_name(),
{
name = potion_def.name .. " Potion",
duration = potion_def.duration * tier_def,
color = potion_def.color,
rounding_steps = 1
}
)
player_data.timers[timer] = true
timer.on_complete = function(playername)
local player_data = players[playername]
player_data.timers[timer] = nil
player_data.in_use = player_data.in_use - 1
potion_def.reverse(playername, gain)
end
timer.on_remove = timer.on_complete
local pos = player:getpos()
local pr = 0.2
minetest.add_particlespawner{
amount = 30,
time = 1.5,
minvel = {x = -pr, y = 0.1, z = -pr},
maxvel = {x = pr, y = 0.5, z = pr},
minacc = {x = -0.05, y = 0.1, z = -0.05},
maxacc = {x = 0.05, y = 0.2, z = 0.05},
minexptime = 2,
maxexptime = 6,
minsize = 0.2,
maxsize = 1,
collisiondetection = false,
vertical = false,
texture = "magic_potions_particle_white.png^[multiply:#" .. potion_def.color,
minpos = pos,
maxpos = pos
}
stack:take_item()
return stack
end
def.inventory_image =
"magic_potions_liquid.png^[multiply:#" ..
potion_def.color .. "^magic_potions_vessel_" .. tier .. ".png^[makealpha:255,0,255"
def.description = tier:sub(1, 1):upper() .. tier:sub(2) .. " " .. potion_def.name .. " Potion"
def.stack_max = max_in_use
minetest.register_craftitem("magic_potions:" .. tier .. "_" .. potion_def.name:lower() .. "_potion", def)
end
end
function player_physics_effect(attribute, gain_func_builder)
return function(tier)
local gain_func = gain_func_builder(tier)
return function(player)
local physics = player:get_physics_override()
local gain = gain_func(physics[attribute], tier)
physics[attribute] = physics[attribute] + gain
player:set_physics_override(physics)
return gain
end
end
end
function player_physics_reverse(attribute)
return function(playername, gain)
local player = minetest.get_player_by_name(playername)
local physics = player:get_physics_override()
physics[attribute] = physics[attribute] - gain
player:set_physics_override(physics)
end
end
function register_physics_potion(name, color, func, lowername)
lowername = lowername or name:lower()
register_potion(
{
name = name,
color = color,
duration = 5,
effect = player_physics_effect(lowername, func),
reverse = player_physics_reverse(lowername)
}
)
end
register_physics_potion(
"Speed",
"DDDD00",
function(t)
return function()
return t / 7
end
end
)
register_physics_potion(
"Jump",
"FF01FF",
function(t)
return function()
return t / 7
end
end
)
register_physics_potion(
"Fly",
"333333",
function(t)
return function(x)
return -x * t / 14
end
end,
"gravity"
)
function regen_effects(property, effect_name)
local affected = {}
magic_potions[effect_name .. "s"] = affected
magic_potions[effect_name] = function(tier)
local gain = tier * 0.2
return function(player)
local name = player:get_player_name()
affected[name] = affected[name] or {total = 0, outstanding = 0}
affected[name].total = affected[name].total + gain
return gain
end
end
magic_potions[effect_name .. "_reverse"] = function(playername, gain)
local total = affected[playername].total - gain
affected[playername].total = total
end
minetest.register_on_joinplayer(function(player)
affected[player:get_player_name()] = {total = 0, outstanding = 0}
end)
minetest.register_on_leaveplayer(function(player)
affected[player:get_player_name()] = nil
end)
minetest.register_globalstep(function(dtime)
for name, effect in pairs(affected) do
effect.outstanding = effect.outstanding + dtime * effect.total
local eff = math.floor(effect.outstanding)
if eff > 0 then
local player = minetest.get_player_by_name(name)
if player and (property ~= "hp" or player:get_hp() > 0) then
player["set_" .. property](
player,
math.min(
player:get_properties()[property .. "_max"],
player["get_" .. property](player) + eff
),
"magic_potions:" .. effect_name
)
end
effect.outstanding = effect.outstanding - eff
end
end
end)
end
regen_effects("hp", "healing")
register_potion{
name = "Healing",
color = "00FF00",
duration = 10,
effect = healing,
reverse = healing_reverse
}
regen_effects("breath", "breathing")
register_potion{
name = "Air",
color = "AAAAFF",
duration = 1,
effect = breathing,
reverse = breathing_reverse
}
function clear_potions(player)
local name = player:get_player_name()
for timer, _ in pairs(players[name].timers) do
timer.time_left = -1
end
hud_timers.maintain_timers(hud_timers.timers[player:get_player_name()], 0, player)
end
minetest.register_on_dieplayer(clear_potions)
minetest.register_on_leaveplayer(clear_potions)
minetest.register_on_leaveplayer(
function(player)
players[player:get_player_name()] = nil
end
)

View File

@ -1,5 +0,0 @@
name=magic_potions
title=Magic Potions
description=Potions which grant player effects
author=Lars Mueller aka appgurueu
depends=hud_timers, modlib

View File

@ -1 +0,0 @@
magic_potions.max_in_use (Magic potions max_in_use) float 3 0.000000 10.000000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

View File

@ -1,44 +0,0 @@
Minetest Game mod: map
======================
See license.txt for license information.
Authors of source code
----------------------
paramat (MIT)
Authors of media (textures)
---------------------------
TumeniNodes (CC BY-SA 3.0):
map_mapping_kit.png (map)
paramat (CC BY-SA 3.0):
map_mapping_kit.png (compass and pen)
Crafting
--------
map:mapping_kit
default:glass G
default:paper P
group:stick S
default:steel_ingot I
group:wood W
dye:black D
GPS
IPI
WPD
Usage
-----
In survival mode, use of the minimap requires the mapping kit item in your
inventory. It can take up to 5 seconds for adding to or removal from inventory
to have an effect, however to instantly allow the use of the minimap 'use'
(leftclick) the item.
Minimap radar mode is always disallowed in survival mode.
Minimap and minimap radar mode are automatically allowed in creative mode and
for any player with the 'creative' privilege.
The 'map.update_hud_flags()' function is global so can be redefined by a mod for
alternative behaviour.

View File

@ -1,80 +0,0 @@
-- map/init.lua
-- Mod global namespace
map = {}
-- Load support for MT game translation.
local S = minetest.get_translator("map")
-- Update HUD flags
-- Global to allow overriding
function map.update_hud_flags(player)
local creative_enabled = minetest.is_creative_enabled(player:get_player_name())
local minimap_enabled = creative_enabled or
player:get_inventory():contains_item("main", "map:mapping_kit")
local radar_enabled = creative_enabled
player:hud_set_flags({
minimap = minimap_enabled,
minimap_radar = radar_enabled
})
end
-- Set HUD flags 'on joinplayer'
minetest.register_on_joinplayer(function(player)
map.update_hud_flags(player)
end)
-- Cyclic update of HUD flags
local function cyclic_update()
for _, player in ipairs(minetest.get_connected_players()) do
map.update_hud_flags(player)
end
minetest.after(5.3, cyclic_update)
end
minetest.after(5.3, cyclic_update)
-- Mapping kit item
minetest.register_craftitem("map:mapping_kit", {
description = S("Mapping Kit") .. "\n" .. S("Use with 'Minimap' key"),
inventory_image = "map_mapping_kit.png",
stack_max = 1,
groups = {flammable = 3, tool = 1},
on_use = function(itemstack, user, pointed_thing)
map.update_hud_flags(user)
end,
})
-- Crafting
minetest.register_craft({
output = "map:mapping_kit",
recipe = {
{"default:glass", "default:paper", "group:stick"},
{"default:steel_ingot", "default:paper", "default:steel_ingot"},
{"group:wood", "default:paper", "dye:black"},
}
})
-- Fuel
minetest.register_craft({
type = "fuel",
recipe = "map:mapping_kit",
burntime = 5,
})

View File

@ -1,60 +0,0 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2017 paramat
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 (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2017 TumeniNodes
Copyright (C) 2017 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/

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Kartenset
Use with 'Minimap' key=Mit „Karte an/aus“-Taste benutzen

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Mapa Ilaro
Use with 'Minimap' key=Uzu per 'malgrandmapo' ŝlosilo

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Kit de cartografía
Use with 'Minimap' key=Usar con la tecla 'Minimapa'

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Kit de carthographie
Use with 'Minimap' key=Utiliser avec le bouton « Minimap »

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Alat Pemetaan
Use with 'Minimap' key=Pakai dengan tombol 'Peta Mini'

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Kit di mappatura
Use with 'Minimap' key=Usalo col tasto 'Minimappa'

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=lo cartu ke sidju bakfu
Use with 'Minimap' key=.i tu'a le cmalu cartu batke cu tadji lo nu pilno

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Alat Pemetaan
Use with 'Minimap' key=Guna dengan kekunci 'Peta Mini'

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Kit de mapeamento
Use with 'Minimap' key=Use com a tecla do 'mini-mapa'

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Картографический комплект
Use with 'Minimap' key=Используйте с ключом 'Minimap'

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Kartläggningssats
Use with 'Minimap' key=Använd med 'Minimap' tangent

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=Kartografická súprava
Use with 'Minimap' key=Použi klávesou 'Prepni minimpu'

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=地图绘制工具包
Use with 'Minimap' key=与“迷你地图”键一起使用

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=地圖繪製工具包
Use with 'Minimap' key=與“迷你地圖”鍵一起使用

View File

@ -1,3 +0,0 @@
# textdomain: map
Mapping Kit=
Use with 'Minimap' key=

View File

@ -1,3 +0,0 @@
name = map
description = Minetest Game mod: map
depends = default, dye

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B