Added a thread and update() calls for gamestate changing.

This commit is contained in:
Filip Maj 2017-01-16 19:14:13 -05:00
parent 6a6ee67ae2
commit 9372b4bc32
7 changed files with 78 additions and 0 deletions

View file

@ -303,6 +303,10 @@ namespace FFXIVClassic_Map_Server.Actors
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
}
public void Update(double deltaTime)
{
}
public void GenerateActorName(int actorNumber)
{
//Format Class Name

View file

@ -373,5 +373,14 @@ namespace FFXIVClassic_Map_Server.Actors
}
}
}
public void Update(double deltaTime)
{
lock (mActorList)
{
foreach (Actor a in mActorList.Values)
a.Update(deltaTime);
}
}
}
}

View file

@ -482,6 +482,30 @@ namespace FFXIVClassic_Map_Server.Actors
return;
}
public void Update(double deltaTime)
{
LuaScript parent = null, child = null;
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null && child == null)
{
//LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
return;
}
//Run Script
if (child != null && child.Globals["onThink"] != null)
child.Call(child.Globals["onThink"], this, deltaTime);
else if (parent != null && parent.Globals["onThink"] != null)
parent.Call(parent.Globals["onThink"], this, deltaTime);
else
return;
}
//A party member list packet came, set the party
/* public void SetParty(MonsterPartyGroup group)
{

View file

@ -1361,5 +1361,10 @@ namespace FFXIVClassic_Map_Server.Actors
currentParty = null;
}
public void Update(double delta)
{
LuaEngine.OnPlayerUpdate(this, delta);
}
}
}