add support to detect hudbars and check if exits, then provide command

* added satation command if mod does not exits and already we have remade mod
* added satiation command only if our mod is present
master
mckayshirou 2023-08-04 17:03:11 -04:00
parent e50a08e5d3
commit 043d3fe7f1
5 changed files with 49 additions and 1 deletions

View File

@ -50,6 +50,7 @@ account at https://vpnapi.io/ and **if not configured, will be used a simple geo
| `/geoip <playername>` | geoip | simple ip player info | no matter if geoip mod is present or not |
| `/cstats` | moderator | to see latest detected cheater | its not a privilegie, use config settings |
| `/cdebug` | moderator | to see even suspected cheats to be verified later | its not a privilegie, use config settings |
| `/satiation` | server | manipulates the satiation of a player | only provide if our mod its present, the original mod already has it |
#### privs

View File

@ -99,4 +99,46 @@ minetest.register_chatcommand("govip", {
--[[ end of commands for geoip and ip location information ]]
--[[ commands for stamina or satiation based on existing mods ]]
if not governing.modhbhunger then
if governing.modhudbars and not hb.redo then
minetest.register_chatcommand("satiation", {
privs = {["server"]=true},
params = S("[<player>] <satiation>"),
description = S("Set satiation of player or yourself"),
func = function(name, param)
if minetest.settings:get_bool("enable_damage") == false then
return false, S("Not possible, damage is disabled.")
end
local targetname, satiation = string.match(param, "(%S+) (%S+)")
if not targetname then
satiation = param
end
satiation = tonumber(satiation)
if not satiation then
return false, S("Invalid satiation!")
end
if not targetname then
targetname = name
end
local target = minetest.get_player_by_name(targetname)
if target == nil then
return false, S("Player @1 does not exist.", targetname)
end
if satiation > hbhunger.SAT_MAX then
satiation = hbhunger.SAT_MAX
elseif satiation < 0 then
satiation = 0
end
hbhunger.hunger[targetname] = satiation
hbhunger.set_hunger_raw(target)
return true
end,
})
end
end
--[[ end commands for stamina or satiation based on existing mods ]]

View File

@ -1,3 +1,4 @@
default?
mail?
boneworld?
hudbars?

View File

@ -27,6 +27,8 @@ local modcreative = minetest.get_modpath("creative") -- if creative is available
local modantispawn = minetest.get_modpath("antispam") -- if rnd1 anticheat mod is loaded, cos only wolrs with mt4
local modanticheat = minetest.get_modpath("anticheat") -- if rnd1 anticheat mod is loaded, cos only wolrs with mt4
local modbeowulf = minetest.get_modpath("beowulf") -- if rnd1 anticheat mod is loaded, cos only wolrs with mt4
local modhudbars = minetest.get_modpath("hudbars") -- if the hudbars mod is loaded and working, from wuzzy
local modhbhunger = minetest.get_modpath("hbhunger") -- if the hudbars hunger mod is loaded and working, from wuzzy
local checkapikey = minetest.settings:get("governing.checkapikey") or "" -- need for geoip improved ip information, then geoip normal will be used
local is_46 = minetest.has_feature("add_entity_with_staticdata") -- detect minetest engine 4.0.16 or mayor
@ -96,6 +98,8 @@ governing.modcommand = modcommand -- if same killme and commands is present as m
governing.modantispawn = modantispawn -- autodetect if older mod antispan by appguru are present
governing.modanticheat = modanticheat -- if rnd1 anticheat mod is present cos only works with mt4
governing.modbeowulf = modbeowulf -- if beowulf anticheat mod is present cos only works with mt5
governing.modhudbars = modhudbars -- if hudbars is present or the mproved hudbars redo
governing.modhbhunger = modhbhunger -- if hbhunger is present or the mproved hudbars redo
governing.checkapikey = checkapikey -- need for geoip improved ip information, then geoip normal will be used
--[[ end - namespace of the mod and varible usages ]]

View File

@ -1,2 +1,2 @@
name = governing
optional_depends = default, mail, boneworld
optional_depends = default, mail, boneworld, hudbars