Change peace to neutral.

This commit is contained in:
Coder12a 2018-10-18 00:15:26 -05:00
parent 091bc27e3a
commit eb6907d405
2 changed files with 40 additions and 40 deletions

View File

@ -439,7 +439,7 @@ if factions_config.faction_diplomacy then
return false
end
if faction.enemies[args.strings[1]] then
send_error(player, "You need to be at peace in-order to send an alliance request.")
send_error(player, "You need to be neutral in-order to send an alliance request.")
return false
end
if args.strings[1] == faction.name then
@ -466,8 +466,8 @@ if factions_config.faction_diplomacy then
end
},false)
factions.register_command("send_peace", {
description = "Send peace to another faction.",
factions.register_command("send_neutral", {
description = "Send neutral to another faction.",
global_privileges = {"faction_user"},
format = {"string"},
on_success = function(player, faction, pos, parcelpos, args)
@ -478,21 +478,21 @@ if factions_config.faction_diplomacy then
send_error(player, "You are allys.")
return false
end
if faction.at_peace_with[args.strings[1]] then
send_error(player, "You are already at peace.")
if faction.neutral[args.strings[1]] then
send_error(player, "You are already neutral with this faction.")
return false
end
if args.strings[1] == faction.name then
send_error(player, "You can not send a peace request to your own faction.")
send_error(player, "You can not send a neutral request to your own faction.")
return false
end
if faction.request_inbox[args.strings[1]] then
send_error(player, "Faction " .. args.strings[1] .. "has already sent a request to you.")
return false
end
factions.factions[args.strings[1]].request_inbox[faction.name] = "peace"
factions.factions[args.strings[1]]:broadcast("A peace request from faction " .. faction.name .. " has been sent to you.")
faction:broadcast("A peace request was sent to faction " .. args.strings[1])
factions.factions[args.strings[1]].request_inbox[faction.name] = "neutral"
factions.factions[args.strings[1]]:broadcast("A neutral request from faction " .. faction.name .. " has been sent to you.")
faction:broadcast("A neutral request was sent to faction " .. args.strings[1])
factions.save()
else
send_error(player, "You have already sent a request.")
@ -521,9 +521,9 @@ if factions_config.faction_diplomacy then
faction:new_alliance(args.strings[1])
factions.factions[args.strings[1]]:new_alliance(faction.name)
else
if faction.request_inbox[args.strings[1]] == "peace" then
faction:new_peace(args.strings[1])
factions.factions[args.strings[1]]:new_peace(faction.name)
if faction.request_inbox[args.strings[1]] == "neutral" then
faction:new_neutral(args.strings[1])
factions.factions[args.strings[1]]:new_neutral(faction.name)
end
end
faction.request_inbox[args.strings[1]] = nil
@ -576,9 +576,9 @@ if factions_config.faction_diplomacy then
faction:end_alliance(args.strings[1])
factions.factions[args.strings[1]]:end_alliance(faction.name)
end
if faction.at_peace_with[args.strings[1]] then
faction:end_peace(args.strings[1])
factions.factions[args.strings[1]]:end_peace(faction.name)
if faction.neutral[args.strings[1]] then
faction:end_neutral(args.strings[1])
factions.factions[args.strings[1]]:end_neutral(faction.name)
end
faction:new_enemy(args.strings[1])
factions.factions[args.strings[1]]:new_enemy(faction.name)
@ -605,8 +605,8 @@ if factions_config.faction_diplomacy then
end
faction:end_alliance(args.strings[1])
factions.factions[args.strings[1]]:end_alliance(faction.name)
faction:new_peace(args.strings[1])
factions.factions[args.strings[1]]:new_peace(faction.name)
faction:new_neutral(args.strings[1])
factions.factions[args.strings[1]]:new_neutral(faction.name)
factions.save()
else
send_error(player, "You where not allies to begin with.")
@ -627,8 +627,8 @@ if factions_config.faction_diplomacy then
if k == "alliance" then
minetest.chat_send_player(player,"Alliance request from faction " .. i .. "\n")
else
if k == "peace" then
minetest.chat_send_player(player,"Peace request from faction " .. i .. "\n")
if k == "neutral" then
minetest.chat_send_player(player,"neutral request from faction " .. i .. "\n")
end
end
empty = false
@ -657,12 +657,12 @@ if factions_config.faction_diplomacy then
end
},false)
factions.register_command("at_peace_with", {
description = "Shows the factions that are at peace with you.",
factions.register_command("neutral", {
description = "Shows the factions that are neutral with you.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local empty = true
for i,k in pairs(faction.at_peace_with) do
for i,k in pairs(faction.neutral) do
minetest.chat_send_player(player,i .. "\n")
empty = false
end

View File

@ -94,7 +94,7 @@ function factions.Faction:new(faction)
--! @brief table of enemies
enemies = {},
--!
at_peace_with = {},
neutral = {},
--! @brief table of parcels/factions that are under attack
attacked_parcels = {},
--! @brief whether faction is closed or open (boolean)
@ -268,7 +268,7 @@ end
function factions.Faction.can_claim_parcel(self, parcelpos)
local fac = factions.parcels[parcelpos]
if fac then
if factions.factions[fac].power < 0. and self.power >= factions_config.power_per_parcel and not self.allies[factions.factions[fac].name] and not self.at_peace_with[factions.factions[fac].name] then
if factions.factions[fac].power < 0. and self.power >= factions_config.power_per_parcel and not self.allies[factions.factions[fac].name] and not self.neutral[factions.factions[fac].name] then
return true
else
return false
@ -337,8 +337,8 @@ function factions.Faction.disband(self, reason)
if v.allies[self.name] then
v:end_alliance(self.name)
end
if v.at_peace_with[self.name] then
v:end_peace(self.name)
if v.neutral[self.name] then
v:end_neutral(self.name)
end
end
end
@ -424,8 +424,8 @@ function factions.Faction.new_alliance(self, faction)
if self.enemies[faction] then
self:end_enemy(faction)
end
if self.at_peace_with[faction] then
self:end_peace(faction)
if self.neutral[faction] then
self:end_neutral(faction)
end
factions.save()
end
@ -434,9 +434,9 @@ function factions.Faction.end_alliance(self, faction)
self:on_end_alliance(faction)
factions.save()
end
function factions.Faction.new_peace(self, faction)
self.at_peace_with[faction] = true
self:on_new_peace(faction)
function factions.Faction.new_neutral(self, faction)
self.neutral[faction] = true
self:on_new_neutral(faction)
if self.allies[faction] then
self:end_alliance(faction)
end
@ -445,9 +445,9 @@ function factions.Faction.new_peace(self, faction)
end
factions.save()
end
function factions.Faction.end_peace(self, faction)
self.at_peace_with[faction] = nil
self:on_end_peace(faction)
function factions.Faction.end_neutral(self, faction)
self.neutral[faction] = nil
self:on_end_neutral(faction)
factions.save()
end
function factions.Faction.new_enemy(self, faction)
@ -456,8 +456,8 @@ function factions.Faction.new_enemy(self, faction)
if self.allies[faction] then
self:end_alliance(faction)
end
if self.at_peace_with[faction] then
self:end_peace(faction)
if self.neutral[faction] then
self:end_neutral(faction)
end
factions.save()
end
@ -633,12 +633,12 @@ function factions.Faction.on_end_alliance(self, faction)
self:broadcast("This faction is no longer allied with "..faction.."!")
end
function factions.Faction.on_new_peace(self, faction)
self:broadcast("This faction is now at peace with "..faction)
function factions.Faction.on_new_neutral(self, faction)
self:broadcast("This faction is now neutral with "..faction)
end
function factions.Faction.on_end_peace(self, faction)
self:broadcast("This faction is no longer at peace with "..faction.."!")
function factions.Faction.on_end_neutral(self, faction)
self:broadcast("This faction is no longer neutral with "..faction.."!")
end
function factions.Faction.on_new_enemy(self, faction)