mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-23 16:30:19 +01:00
Added broomstick by @paly2
- Added a broomstick craftable from wheat and sticks, and allowing you to fly for 2 minutes using 210 units of mana
This commit is contained in:
parent
cb04264888
commit
19a2dea367
1
mods/broomstick/depends.txt
Executable file
1
mods/broomstick/depends.txt
Executable file
@ -0,0 +1 @@
|
|||||||
|
mana
|
87
mods/broomstick/init.lua
Executable file
87
mods/broomstick/init.lua
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
local broomstick_time = 120 -- Seconds (for default 2 minutes)
|
||||||
|
local broomstick_mana = 210
|
||||||
|
local broomstick_actual_users = {}
|
||||||
|
local had_fly_privilege = {}
|
||||||
|
local privs = {}
|
||||||
|
|
||||||
|
-- Register broomstick
|
||||||
|
minetest.register_craftitem("broomstick:broomstick", {
|
||||||
|
description = "Broomstick",
|
||||||
|
inventory_image = "broomstick.png",
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
local playername = user:get_player_name()
|
||||||
|
if mana.get(playername) >= broomstick_mana then
|
||||||
|
local has_already_a_broomstick = false
|
||||||
|
for i in ipairs(broomstick_actual_users) do
|
||||||
|
if i.name == playername then
|
||||||
|
has_already_a_broomstick = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not has_already_a_broomstick then
|
||||||
|
privs = minetest.get_player_privs(playername)
|
||||||
|
-- Set player privs...
|
||||||
|
if not privs.fly == true then
|
||||||
|
privs.fly = true
|
||||||
|
minetest.set_player_privs(playername, privs)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(playername, "You known you " ..
|
||||||
|
"can fly by yourself, don't you?")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- Send a message...
|
||||||
|
minetest.chat_send_player(playername, "You can now fly during "
|
||||||
|
.. tostring(broomstick_time) .. " seconds.")
|
||||||
|
minetest.log("action", "Player " .. playername
|
||||||
|
.." has use a broomstick.")
|
||||||
|
-- Subtract mana...
|
||||||
|
mana.subtract(playername, broomstick_mana)
|
||||||
|
-- And insert player in the list.
|
||||||
|
table.insert(broomstick_actual_users, {
|
||||||
|
name = playername,
|
||||||
|
time = 0,
|
||||||
|
is_warning_said = false
|
||||||
|
})
|
||||||
|
-- Remove broomstick...
|
||||||
|
return ItemStack("")
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(playername, "You already have a " ..
|
||||||
|
"broomstick ! Please wait until the end of your actual " ..
|
||||||
|
"broomstick.")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(playername, "You must have " ..
|
||||||
|
tostring(broomstick_mana) .. " of mana to use a broomstick !")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Broomstick timer
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
for index, i in ipairs(broomstick_actual_users) do
|
||||||
|
i.time = i.time + dtime
|
||||||
|
-- Just a little warning message
|
||||||
|
if i.time >= broomstick_time - 10 and not i.is_warning_said then
|
||||||
|
minetest.chat_send_player(i.name,
|
||||||
|
"WARNING ! You'll fall in 10 seconds !")
|
||||||
|
i.is_warning_said = true
|
||||||
|
elseif i.time >= broomstick_time then
|
||||||
|
-- Send a message...
|
||||||
|
minetest.chat_send_player(i.name, "End of broomstick. " ..
|
||||||
|
"I hope you're not falling down...")
|
||||||
|
-- Set player privs...
|
||||||
|
privs = minetest.get_player_privs(i.name)
|
||||||
|
privs["fly"] = nil
|
||||||
|
minetest.set_player_privs(i.name, privs)
|
||||||
|
-- And remove the player in the list.
|
||||||
|
table.remove(broomstick_actual_users, index)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Craft
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "broomstick:broomstick",
|
||||||
|
recipe = {{"default:stick","default:stick","farming:wheat",}},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.log("action", "[OK] broomstick")
|
BIN
mods/broomstick/textures/broomstick.png
Executable file
BIN
mods/broomstick/textures/broomstick.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -4,6 +4,9 @@ News de FR - MinetestForFun (Survival - PVP - Hardcore)
|
|||||||
/!\ Le serveur étant devenu stable, les MAJs vont se rarifier pour un temps /!\
|
/!\ Le serveur étant devenu stable, les MAJs vont se rarifier pour un temps /!\
|
||||||
/!\ En effet, nous profitons de cette stabilitée pour préparer une grosse MAJ qui boulversera à jamais le gameplay de Minetest /!\
|
/!\ En effet, nous profitons de cette stabilitée pour préparer une grosse MAJ qui boulversera à jamais le gameplay de Minetest /!\
|
||||||
|
|
||||||
|
---Next merge--- (Remerciements : ???)
|
||||||
|
Ajout du mod "broomstick" de palige (permet d'utiliser un balai volant contre 210 de mana)
|
||||||
|
|
||||||
---21/06/2015--- (Remerciements : mgl512/Le_Docteur, LeMagnesium/Mg, crabman77/crabman, Obani)
|
---21/06/2015--- (Remerciements : mgl512/Le_Docteur, LeMagnesium/Mg, crabman77/crabman, Obani)
|
||||||
MAJ de "tsm_pyramids/mummy.lua" (bugfix de la texture des mommies)
|
MAJ de "tsm_pyramids/mummy.lua" (bugfix de la texture des mommies)
|
||||||
MAJ de "plantlife" (amélioration du code, bugfix)
|
MAJ de "plantlife" (amélioration du code, bugfix)
|
||||||
|
@ -152,6 +152,7 @@ load_mod_sprint = true
|
|||||||
load_mod_mana = true
|
load_mod_mana = true
|
||||||
load_mod_solarmana = true
|
load_mod_solarmana = true
|
||||||
load_mod_runes = false
|
load_mod_runes = false
|
||||||
|
load_mod_broomstick = true
|
||||||
load_mod_awards = true
|
load_mod_awards = true
|
||||||
load_mod_fail = true
|
load_mod_fail = true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user