Compare commits

..

13 Commits

Author SHA1 Message Date
512528fc46 Merge remote-tracking branch 'upstream/master' 2023-11-25 15:32:15 +01:00
Wuzzy
5fe79310b3 Remove list of example mods from README.md 2023-06-20 09:26:49 +02:00
Wuzzy
1ef5d93ffc Update mod.conf 2023-06-20 09:25:51 +02:00
Wuzzy
397286e12f Remove empty depends.txt 2023-06-20 09:25:19 +02:00
Wuzzy
e058592e3a Add .mailmap file for Wuzzy 2023-06-20 09:24:54 +02:00
Wuzzy
22324f3a6c Replace minetest.debug with minetest.log 2023-06-20 09:24:35 +02:00
1cd8491447 Update mod.conf, delete depends.txt and description.txt 2022-06-26 11:30:41 +02:00
2d9ab0d4c9 Merge remote-tracking branch 'upstream/master' 2022-06-26 11:28:18 +02:00
Wuzzy
e1bc0e23c8 Reduce debug log level for autosaving debug msgs 2019-06-23 13:09:16 +02:00
Wuzzy
f8d70283d1 This mod is finished 2019-02-22 01:42:50 +01:00
Wuzzy
51547f2e70 Fix slowregen example 2017-08-06 16:40:01 +02:00
Wuzzy
a043aadeff Add standadized group names 2017-08-06 16:15:29 +02:00
Wuzzy
c87592a9cf Fix typo in examples.lua 2017-08-06 15:52:52 +02:00
7 changed files with 24 additions and 15 deletions

2
.mailmap Normal file
View File

@ -0,0 +1,2 @@
Wuzzy <Wuzzy@disroot.org> <Wuzzy2@mail.ru>
Wuzzy <Wuzzy@disroot.org> <almikes@aol.com>

View File

@ -1,6 +1,6 @@
# Player Effects
## Summary
This is an framework for assigning temporary status effects to players. This mod is aimed to modders and maybe interested people. This framework is a work in progress and not finished.
This is an framework for assigning temporary status effects to players. This mod is aimed to modders and maybe interested people.
## Profile
* Name: Player Effects
@ -14,9 +14,7 @@ This is an framework for assigning temporary status effects to players. This mod
This mod alone is not aimed directly at players. Briefly, the point of this mod is to help other mods to implement temporary status effects for players in a clean and consistant way.
Here is the information which may be relevant to you: Your current status effects are shown on the HUD on the right side, along with a timer which shows the time until the effect gets disabled. It is possible for the server to disable this feature entirely. Some status effects may also be hidden and are never exposed to the HUD.
You only have to install this mod iff you have a mod which implements Player Effects. Here is a list of known mods which do:
* Magic Beans—Wuzzys Fork [`magicbeans_w`]
You only have to install this mod iff you have a mod which implements Player Effects.
## Information for server operators
By default, this mod stores the effects into the file `playereffects.mt` in the current world path every 10 seconds. On a regular server shutdown, this file is also written to. The data in this file is read when the mod is started.
@ -65,11 +63,19 @@ Normally you dont need to read or edit fields of this table. Use `playereffec
#### Effect group
An effect group is basically a concept. Any effect type can be member of any number of effect groups. The main point of effect groups is to find effects which affect the same property. For example, an effect which makes you faster and another effect which makes you slower both affect the same property: speed. The group for that then would be the string `"speed"`. See also `examples.lua`, which includes the effects `high_speed` and `low_speed`.
Currently, the main rule of Player Effects requires that there can only be one effect in place. Dont worry, Player Effects already does that job for you. Back to the example: it is possible to be fast and it is possible to be slow. But it is not possible to be fast `and` slow at the same time. Player Effects ensures that by cancelling all conflicting concepts before applying a new one.
Currently, the main rule of Player Effects requires that there can only be one effect in place. Player Effects already does that job for you. Back to the example: it is possible to be fast and it is possible to be slow. But it is not possible to be fast *and* slow at the same time. Player Effects ensures that by cancelling all conflicting concepts before applying a new one.
The concept of groups may be changed or extended in the future.
You can invent effect groups (like the groups in Minetest) on the fly. A group is just a string. Practically, you should use groups which other people use.
The following effect group names have standardized meanings and should solely be used for their intended purpose:
* `speed`: Affects the player speed set by the `speed` value of `set_physics_override`
* `gravity`: Affects the player gravity set by the `gravity` value of `set_physics_override`
* `jump`: Affects the player jump strength set by the `jump` value of `set_physics_override`
* `health`: Affects the player health
* `breath`: Affects the player breath
You can also invent effect groups (like the groups in Minetest) on the fly. A group is just a string. Practically, you should use groups which other people use.
#### Effect (`effect`)
An effect is an current change of a player property (like speed, jump height, and so on). It is the realization of an effect type. All effects are temporary. There are currently two types of effects: Repeating and non-repeating. Non-repeating effects call their `apply` callback once when they are created. Repeating effects call their apply callback multiple times with a specified interval. By default, effects are non-repeating.

View File

View File

@ -1 +0,0 @@
Framework for temporary effects for players.

View File

@ -115,11 +115,11 @@ playereffects.register_effect_type("slowregen", "Slow Regeneration", "heart.png"
function(player)
player:set_hp(player:get_hp()+1)
end,
nil, nil, nil, 15
nil, nil, nil, 3
)
-- Dummy effect for the stree test
-- Dummy effect for the stress test
playereffects.register_effect_type("stress", "Stress Test Effect", nil, {},
function(player)
end,

View File

@ -56,10 +56,10 @@ do
if(string ~= nil) then
local savetable = minetest.deserialize(string)
playereffects.inactive_effects = savetable.inactive_effects
minetest.debug("[playereffects] playereffects.mt successfully read.")
minetest.debug("[playereffects] inactive_effects = "..dump(playereffects.inactive_effects))
minetest.log("action", "[playereffects] playereffects.mt successfully read.")
minetest.log("verbose", "[playereffects] inactive_effects = "..dump(playereffects.inactive_effects))
playereffects.last_effect_id = savetable.last_effect_id
minetest.debug("[playereffects] last_effect_id = "..dump(playereffects.last_effect_id))
minetest.log("verbose", "[playereffects] last_effect_id = "..dump(playereffects.last_effect_id))
end
end
@ -355,7 +355,7 @@ function playereffects.save_to_file()
if file then
file:write(savestring)
io.close(file)
minetest.log("verbose", "[playereffects] Wrote playereffects data into "..filepath..".")
minetest.log("info", "[playereffects] Wrote playereffects data into "..filepath..".")
else
minetest.log("error", "[playereffects] Failed to write playereffects data into "..filepath..".")
end
@ -393,7 +393,7 @@ minetest.register_on_leaveplayer(function(player)
end)
minetest.register_on_shutdown(function()
minetest.log("action", "[playereffects] Server shuts down. Rescuing data into playereffects.mt")
minetest.log("info", "[playereffects] Server shuts down. Rescuing data into playereffects.mt")
playereffects.save_to_file()
end)
@ -427,7 +427,7 @@ minetest.register_globalstep(function(dtime)
-- Autosave into file
if(playereffects.use_autosave == true and playereffects.autosave_timer >= playereffects.autosave_time) then
playereffects.autosave_timer = 0
minetest.log("verbose", "[playereffects] Autosaving mod data to playereffects.mt ...")
minetest.log("info", "[playereffects] Autosaving mod data to playereffects.mt ...")
playereffects.save_to_file()
end
end)

View File

@ -1 +1,3 @@
name = playereffects
title = Player Effects
description = Framework for temporary effects for players.