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
|
||||
factions_chat = {}
|
||||
|
||||
factions.commands = {}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: init()
|
||||
--
|
||||
@ -228,7 +230,7 @@ factions.register_command("info", {
|
||||
})
|
||||
|
||||
factions.register_command("leave", {
|
||||
description = "Leave your faction."
|
||||
description = "Leave your faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
faction:remove_player(player)
|
||||
--TODO: message?
|
||||
@ -242,8 +244,8 @@ factions.register_command("kick", {
|
||||
description = "Kick a player from your faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
local victim = args.players[1]
|
||||
if factions.players[victim.name] == faction.name then
|
||||
and victim.name ~= faction.leader -- can't kick da king
|
||||
if factions.players[victim.name] == faction.name
|
||||
and victim.name ~= faction.leader then -- can't kick da king
|
||||
faction:remove_player(player)
|
||||
--TODO: message?
|
||||
return true
|
||||
@ -277,7 +279,7 @@ factions.register_command("create", {
|
||||
end
|
||||
})
|
||||
|
||||
factions.register_commmand("join", {
|
||||
factions.register_command("join", {
|
||||
format = {"faction"},
|
||||
description = "Join a faction.",
|
||||
infaction = false,
|
||||
@ -342,7 +344,7 @@ factions.register_command("invite", {
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Invite a player to your faction.",
|
||||
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
|
||||
return true
|
||||
end
|
||||
@ -353,7 +355,7 @@ factions.register_command("uninvite", {
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Revoke a player's invite.",
|
||||
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
|
||||
return true
|
||||
end
|
||||
|
23
factions.lua
23
factions.lua
@ -43,7 +43,7 @@ factions.can_create_faction = function(name)
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end,
|
||||
end
|
||||
end
|
||||
|
||||
---------------------
|
||||
@ -125,7 +125,7 @@ factions.new_faction = function(name)
|
||||
self:on_player_invited(player)
|
||||
end,
|
||||
revoke_invite = function(self, player)
|
||||
self.invited_player[player = nil
|
||||
self.invited_player[player] = nil
|
||||
self:on_revoke_invite(player)
|
||||
end,
|
||||
is_invited = function(self, player)
|
||||
@ -151,7 +151,7 @@ factions.new_faction = function(name)
|
||||
end,
|
||||
new_enemy = function(self, faction)
|
||||
self.enemies[faction] = true
|
||||
self:on_new_enemy[faction]
|
||||
self:on_new_enemy(faction)
|
||||
if self.allies[faction] then
|
||||
self:end_alliance(faction)
|
||||
end
|
||||
@ -226,7 +226,7 @@ factions.new_faction = function(name)
|
||||
--TODO: implement
|
||||
end,
|
||||
}
|
||||
factions[name] = faction
|
||||
factions.factions[name] = faction
|
||||
return faction
|
||||
end
|
||||
|
||||
@ -242,6 +242,7 @@ end
|
||||
|
||||
function factions.get_chunkpos(pos)
|
||||
return {math.floor(pos.x / 16.), math.floor(pos.z / 16.)}
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@ -256,13 +257,13 @@ function factions.get_chunkpos(pos)
|
||||
--! @return faction object/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.add_faction(name)
|
||||
if factions.can_create_faction(name) then
|
||||
local fac = factions.new_faction(name)
|
||||
fac:on_create()
|
||||
return fac
|
||||
else
|
||||
return nil
|
||||
end,
|
||||
if factions.can_create_faction(name) then
|
||||
local fac = factions.new_faction(name)
|
||||
fac:on_create()
|
||||
return fac
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user