Clan
var
name
tmp
list/online = list()
list/members
owner
level = 1
proc
ClanInvite(var/mob/inviter, var/mob/invited)
if(inviter.clan==src&&invited.clan==null)
switch(alert("[inviter] invites you to join the clan [name].", "Yes","No"))
if("Yes")
Joined(invited)
if("No") return
Joined(var/mob/m)
m.clan = src
m.clan_name = src.name
src.online += m
src.members += m.name
m.Save()
SaveClan()
Leave(var/mob/m)
if(owner == m.name)
if(members.len > 1)
. = null
while(!(. in members))
. = ChooseLeader(m)
if(.==null)
return
owner = .
else
var/mob/s = owner
s.clan_name = null
s.clan = null
fdel("saves/clans/[ckey(src.name)].sav")
clans -= src.name
src.name = null
del src
src.members -= m.name
m.clan_name = null
m.clan = null
src.Logout(m)
SaveClan()
Remove(var/player)
if(player in members)
for(var/mob/p in online)
if(p.name == player)
Leave(p)
return
if(owner == player)
return 0
members -= player
SaveClan()
ChooseLeader(var/mob/m)
var/list/l = src.members.Copy(1,0)
l -= owner
return input(m, "Change Leader", "Who should become owner of [src.name]?") as text| anything in l
Login(var/mob/m)
if(m.name in members)
online += m
m.clan = src
else
m.clan_name = null
m.clan = null
if(src.online.len == 0)
clans -= src.name
src.name = null
del src
Logout(var/mob/m)
online -= m
if(src.online.len==0)
del src
Create(var/mob/m)
owner = m.name
members += m.name
while(src.name == null)
src.name = input("What is your clan's surname?") as text|null
if(fexists("saves/clans/[ckey(src.name)].sav"))
src.name = null
SaveClan()
clans[src.name] = src
SaveClan()
var/savefile/F = new/savefile("saves/clans/[ckey(src.name)].sav")
F << src
Read(var/savefile/F)
.=..()
if(src.name)
clans[src.name] = src
Del()
if(src.name)
SaveClan()
clans -= src.name
return ..()
var
list
clans = list()
proc
getClan(var/name)
if(name == null) return null
if(name in clans)
return clans[name]
else if(fexists("saves/clans/[ckey(name)].sav"))
var/savefile/F = new/savefile("saves/clans/[ckey(name)].sav")
var/Clan/c
F >> c
return c
else
return null
mob
var
clan_name = null
tmp
Clan/clan
Login()
.=..()
src.clan = getClan(src.clan_name)
if(src.clan)
src << "[src.clan]"
src.clan.Login(src)
Logout()
if(src.clan)
src.clan.Logout(src)
.=..()
verb
Form_Clan()
src.clan.Create(src)
When I use the Form_Clan verb it gives me an error;
runtime error: Cannot execute null.Create().
proc name: Form Clan (/mob/verb/Form_Clan)
usr: Gluscap (/mob)
src: Gluscap (/mob)
call stack:
Gluscap (/mob): Form Clan()
Any reason why it would do that?
As you can see, you have to initialize a new clan in order to call a proc on it the first time.