mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 18:40:25 +01:00
fix only play pclasses sound to player and only if player switch classes
This commit is contained in:
parent
7621b867c3
commit
e0ce022cac
@ -7,8 +7,10 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
pclasses.api.register_class("admin", {
|
pclasses.api.register_class("admin", {
|
||||||
on_assigned = function(pname)
|
on_assigned = function(pname, inform)
|
||||||
minetest.chat_send_player(pname, "Hello admin.")
|
if inform then
|
||||||
|
minetest.chat_send_player(pname, "Hello admin.")
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
on_unassigned = function(pname)
|
on_unassigned = function(pname)
|
||||||
end,
|
end,
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
pclasses.api.register_class("hunter", {
|
pclasses.api.register_class("hunter", {
|
||||||
on_assigned = function(pname)
|
on_assigned = function(pname, inform)
|
||||||
minetest.chat_send_player(pname, "You are now a hunter")
|
if inform then
|
||||||
minetest.sound_play("pclasses_full_hunter")
|
minetest.chat_send_player(pname, "You are now a hunter")
|
||||||
|
minetest.sound_play("pclasses_full_hunter", {to_player=pname, gain=1})
|
||||||
|
end
|
||||||
local reinforced = pclasses.api.util.does_wear_full_armor(pname, "reinforcedleather", true)
|
local reinforced = pclasses.api.util.does_wear_full_armor(pname, "reinforcedleather", true)
|
||||||
if reinforced then
|
if reinforced then
|
||||||
sprint.increase_maxstamina(pname, 20)
|
sprint.increase_maxstamina(pname, 20)
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
pclasses.api.register_class("warrior", {
|
pclasses.api.register_class("warrior", {
|
||||||
on_assigned = function(pname)
|
on_assigned = function(pname, inform)
|
||||||
minetest.sound_play("pclasses_full_warrior")
|
if inform then
|
||||||
minetest.chat_send_player(pname, "You are now a warrior")
|
minetest.sound_play("pclasses_full_warrior", {to_player=pname, gain=1})
|
||||||
|
minetest.chat_send_player(pname, "You are now a warrior")
|
||||||
|
end
|
||||||
sprint.set_maxstamina(pname, 20)
|
sprint.set_maxstamina(pname, 20)
|
||||||
minetest.log("action", "[PClasses] Player " .. pname .. " becomes a warrior")
|
minetest.log("action", "[PClasses] Player " .. pname .. " becomes a warrior")
|
||||||
end,
|
end,
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
pclasses.api.register_class("wizard", {
|
pclasses.api.register_class("wizard", {
|
||||||
on_assigned = function(pname)
|
on_assigned = function(pname, inform)
|
||||||
-- minetest.sound_play("pclasses_full_wizard")
|
if inform then
|
||||||
minetest.chat_send_player(pname, "You are now a wizard.")
|
-- minetest.sound_play("pclasses_full_wizard", {to_player=pname, gain=1})
|
||||||
|
minetest.chat_send_player(pname, "You are now a wizard.")
|
||||||
|
end
|
||||||
-- Add specs here
|
-- Add specs here
|
||||||
minetest.log("action", "[PClasses] Player " .. pname .. " becomes a wizard")
|
minetest.log("action", "[PClasses] Player " .. pname .. " becomes a wizard")
|
||||||
end,
|
end,
|
||||||
|
@ -8,8 +8,10 @@ pclasses.api.register_class("adventurer", {
|
|||||||
tile = "wool_white.png",
|
tile = "wool_white.png",
|
||||||
holo_item = "unified_inventory:bag_large"
|
holo_item = "unified_inventory:bag_large"
|
||||||
},
|
},
|
||||||
on_assigned = function(pname)
|
on_assigned = function(pname, inform)
|
||||||
minetest.chat_send_player(pname, "You are now an adventurer")
|
if inform then
|
||||||
|
minetest.chat_send_player(pname, "You are now an adventurer")
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
on_unassigned = function(pname)
|
on_unassigned = function(pname)
|
||||||
end
|
end
|
||||||
|
@ -48,13 +48,13 @@ function pclasses.api.get_class_players(cname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Set single player
|
-- Set single player
|
||||||
function pclasses.api.set_player_class(pname, cname)
|
function pclasses.api.set_player_class(pname, cname, inform)
|
||||||
if pclasses.api.get_class_by_name(cname) then
|
if pclasses.api.get_class_by_name(cname) then
|
||||||
if pclasses.api.get_player_class(pname) then
|
if pclasses.api.get_player_class(pname) then
|
||||||
pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_unassigned(pname)
|
pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_unassigned(pname)
|
||||||
end
|
end
|
||||||
pclasses.data.players[pname] = cname
|
pclasses.data.players[pname] = cname
|
||||||
pclasses.api.get_class_by_name(cname).on_assigned(pname)
|
pclasses.api.get_class_by_name(cname).on_assigned(pname, inform)
|
||||||
|
|
||||||
local ref = minetest.get_player_by_name(pname)
|
local ref = minetest.get_player_by_name(pname)
|
||||||
local armor_inv = minetest.get_inventory({type = "detached", name = pname .. "_armor"})
|
local armor_inv = minetest.get_inventory({type = "detached", name = pname .. "_armor"})
|
||||||
|
@ -48,7 +48,7 @@ minetest.register_entity("pclasses:item", {
|
|||||||
"class_switch_" .. clicker:get_player_name(),
|
"class_switch_" .. clicker:get_player_name(),
|
||||||
3600,
|
3600,
|
||||||
pclasses.api.set_player_class,
|
pclasses.api.set_player_class,
|
||||||
{clicker:get_player_name(), self.class}
|
{clicker:get_player_name(), self.class, true}
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
|
Loading…
Reference in New Issue
Block a user