Initial factions commit
commit
e404bac84d
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,201 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- factions Mod by Sapier
|
||||
--
|
||||
-- License WTFPL
|
||||
--
|
||||
--! @file factions.lua
|
||||
--! @brief factions core file containing datastorage
|
||||
--! @copyright Sapier
|
||||
--! @author Sapier
|
||||
--! @date 2013-05-08
|
||||
--
|
||||
-- Contact sapier a t gmx net
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
--! @class factions
|
||||
--! @brief main class for factions
|
||||
factions = {}
|
||||
|
||||
--! @brief runtime data
|
||||
factions.data = {}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: add_faction(name)
|
||||
--
|
||||
--! @brief add a faction
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name of faction to add
|
||||
--!
|
||||
--! @return true/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.add_faction(name)
|
||||
|
||||
if factions.data[name] == nil then
|
||||
factions.data[name] = {}
|
||||
|
||||
factions.save()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: set_base_reputation(faction1,faction2,value)
|
||||
--
|
||||
--! @brief set base reputation between two factions
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param faction1 first faction
|
||||
--! @param faction2 second faction
|
||||
--! @param value value to use
|
||||
--!
|
||||
--! @return true/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.set_base_reputation(faction1,faction2,value)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: del_faction(name)
|
||||
--
|
||||
--! @brief delete a faction
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name of faction to delete
|
||||
--!
|
||||
--! @return true/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.del_faction(name)
|
||||
|
||||
factions.data[name] = nil
|
||||
|
||||
factions.save()
|
||||
|
||||
if factions.data[name] == nil then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: member_add(name,object)
|
||||
--
|
||||
--! @brief add an entity or player to a faction
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name of faction to add object to
|
||||
--! @param object to add to faction
|
||||
--!
|
||||
--! @return true/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.member_add(name, object)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: member_remove(name,object)
|
||||
--
|
||||
--! @brief remove an entity or player to a faction
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name of faction to add object to
|
||||
--! @param object to add to faction
|
||||
--!
|
||||
--! @return true/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.member_remove(name,object)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: set_admin(name,playername,value)
|
||||
--
|
||||
--! @brief set admin priviles for a playername
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name of faction to add object to
|
||||
--! @param playername to change rights
|
||||
--! @param value true/false has or has not admin privileges
|
||||
--!
|
||||
--! @return true/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.set_admin(name,playername,value)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: set_admin(name,playername,value)
|
||||
--
|
||||
--! @brief set admin priviles for a playername
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name of faction to add object to
|
||||
--! @param playername to change rights
|
||||
--!
|
||||
--! @return true/false (succesfully added faction or not)
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.is_admin(name,playername)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: get_factions(object)
|
||||
--
|
||||
--! @brief get list of factions for an object
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param object to get list for
|
||||
--!
|
||||
--! @return list of factions
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.get_factions(object)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: get_reputation(name,object)
|
||||
--
|
||||
--! @brief get reputation of an object
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name name of faction to check for reputation
|
||||
--! @param object object to get reputation for
|
||||
--!
|
||||
--! @return number value -100 to 100 0 being neutral, -100 beeing enemy 100 friend
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.get_reputation(name,object)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: get_reputation(name,object,delta)
|
||||
--
|
||||
--! @brief get reputation of an object
|
||||
--! @memberof factions
|
||||
--! @public
|
||||
--
|
||||
--! @param name name of faction to modify reputation
|
||||
--! @param object object to change reputation
|
||||
--! @param delta value to change reputation
|
||||
--!
|
||||
--! @return number value -100 to 100 0 being neutral, -100 beeing enemy 100 friend
|
||||
-------------------------------------------------------------------------------
|
||||
function factions.modify_reputation(name,object,delta)
|
||||
return false
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- factions Mod by Sapier
|
||||
--
|
||||
-- License WTFPL
|
||||
--
|
||||
--! @file init.lua
|
||||
--! @brief factions mod to be used by other mods
|
||||
--! @copyright Sapier
|
||||
--! @author Sapier
|
||||
--! @date 2013-05-08
|
||||
--!
|
||||
-- Contact sapier a t gmx net
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local factions_version = "0.0.1"
|
||||
|
||||
print("MOD: factions (by sapier) loading ...")
|
||||
|
||||
--!path of mod
|
||||
factions_modpath = minetest.get_modpath("factions")
|
||||
|
||||
|
||||
dofile (factions_modpath .. "/factions.lua")
|
||||
dofile (factions_modpath .. "/chatcommands.lua")
|
||||
|
||||
print("MOD: factions (by sapier) " .. factions_version .. " loaded.")
|
Loading…
Reference in New Issue