forked from mtcontrib/factions
Fixed all syntax errors
This commit is contained in:
parent
37b948f1f6
commit
a52fe6a6bf
@ -16,6 +16,8 @@
|
|||||||
--! @brief chat interface class
|
--! @brief chat interface class
|
||||||
factions_chat = {}
|
factions_chat = {}
|
||||||
|
|
||||||
|
factions.commands = {}
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- name: init()
|
-- name: init()
|
||||||
--
|
--
|
||||||
@ -228,7 +230,7 @@ factions.register_command("info", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
factions.register_command("leave", {
|
factions.register_command("leave", {
|
||||||
description = "Leave your faction."
|
description = "Leave your faction.",
|
||||||
on_success = function(player, faction, pos, chunkpos, args)
|
on_success = function(player, faction, pos, chunkpos, args)
|
||||||
faction:remove_player(player)
|
faction:remove_player(player)
|
||||||
--TODO: message?
|
--TODO: message?
|
||||||
@ -242,8 +244,8 @@ factions.register_command("kick", {
|
|||||||
description = "Kick a player from your faction.",
|
description = "Kick a player from your faction.",
|
||||||
on_success = function(player, faction, pos, chunkpos, args)
|
on_success = function(player, faction, pos, chunkpos, args)
|
||||||
local victim = args.players[1]
|
local victim = args.players[1]
|
||||||
if factions.players[victim.name] == faction.name then
|
if factions.players[victim.name] == faction.name
|
||||||
and victim.name ~= faction.leader -- can't kick da king
|
and victim.name ~= faction.leader then -- can't kick da king
|
||||||
faction:remove_player(player)
|
faction:remove_player(player)
|
||||||
--TODO: message?
|
--TODO: message?
|
||||||
return true
|
return true
|
||||||
@ -277,7 +279,7 @@ factions.register_command("create", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
factions.register_commmand("join", {
|
factions.register_command("join", {
|
||||||
format = {"faction"},
|
format = {"faction"},
|
||||||
description = "Join a faction.",
|
description = "Join a faction.",
|
||||||
infaction = false,
|
infaction = false,
|
||||||
@ -342,7 +344,7 @@ factions.register_command("invite", {
|
|||||||
faction_permissions = {"playerslist"},
|
faction_permissions = {"playerslist"},
|
||||||
description = "Invite a player to your faction.",
|
description = "Invite a player to your faction.",
|
||||||
on_success = function(player, faction, pos, chunkpos, args)
|
on_success = function(player, faction, pos, chunkpos, args)
|
||||||
faction:invite_player(args.players[1]:get_player_name)
|
faction:invite_player(args.players[1]:get_player_name())
|
||||||
--TODO: message
|
--TODO: message
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -353,7 +355,7 @@ factions.register_command("uninvite", {
|
|||||||
faction_permissions = {"playerslist"},
|
faction_permissions = {"playerslist"},
|
||||||
description = "Revoke a player's invite.",
|
description = "Revoke a player's invite.",
|
||||||
on_success = function(player, faction, pos, chunkpos, args)
|
on_success = function(player, faction, pos, chunkpos, args)
|
||||||
faction:revoke_invite(args.players[1]:get_player_name)
|
faction:revoke_invite(args.players[1]:get_player_name())
|
||||||
--TODO: message
|
--TODO: message
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
11
factions.lua
11
factions.lua
@ -43,7 +43,7 @@ factions.can_create_faction = function(name)
|
|||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end,
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
@ -125,7 +125,7 @@ factions.new_faction = function(name)
|
|||||||
self:on_player_invited(player)
|
self:on_player_invited(player)
|
||||||
end,
|
end,
|
||||||
revoke_invite = function(self, player)
|
revoke_invite = function(self, player)
|
||||||
self.invited_player[player = nil
|
self.invited_player[player] = nil
|
||||||
self:on_revoke_invite(player)
|
self:on_revoke_invite(player)
|
||||||
end,
|
end,
|
||||||
is_invited = function(self, player)
|
is_invited = function(self, player)
|
||||||
@ -151,7 +151,7 @@ factions.new_faction = function(name)
|
|||||||
end,
|
end,
|
||||||
new_enemy = function(self, faction)
|
new_enemy = function(self, faction)
|
||||||
self.enemies[faction] = true
|
self.enemies[faction] = true
|
||||||
self:on_new_enemy[faction]
|
self:on_new_enemy(faction)
|
||||||
if self.allies[faction] then
|
if self.allies[faction] then
|
||||||
self:end_alliance(faction)
|
self:end_alliance(faction)
|
||||||
end
|
end
|
||||||
@ -226,7 +226,7 @@ factions.new_faction = function(name)
|
|||||||
--TODO: implement
|
--TODO: implement
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
factions[name] = faction
|
factions.factions[name] = faction
|
||||||
return faction
|
return faction
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -242,6 +242,7 @@ end
|
|||||||
|
|
||||||
function factions.get_chunkpos(pos)
|
function factions.get_chunkpos(pos)
|
||||||
return {math.floor(pos.x / 16.), math.floor(pos.z / 16.)}
|
return {math.floor(pos.x / 16.), math.floor(pos.z / 16.)}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -262,7 +263,7 @@ function factions.add_faction(name)
|
|||||||
return fac
|
return fac
|
||||||
else
|
else
|
||||||
return nil
|
return nil
|
||||||
end,
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user