mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 21:27:46 +00:00
cleaned up some of my retard with deltaTime and changed to DateTime for convenience swapping between seconds/milliseconds
This commit is contained in:
parent
3bcaa4cc3e
commit
b9bfe5e985
9 changed files with 27 additions and 20 deletions
|
@ -956,8 +956,9 @@ namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
lock (zoneList)
|
lock (zoneList)
|
||||||
{
|
{
|
||||||
|
var tick = DateTime.Now;
|
||||||
foreach (Zone zone in zoneList.Values)
|
foreach (Zone zone in zoneList.Values)
|
||||||
zone.Update(MILIS_LOOPTIME);
|
zone.Update(tick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,7 +979,7 @@ namespace FFXIVClassic_Map_Server
|
||||||
}
|
}
|
||||||
|
|
||||||
public Actor GetActorInWorld(uint charId)
|
public Actor GetActorInWorld(uint charId)
|
||||||
{
|
{
|
||||||
foreach (Zone zone in zoneList.Values)
|
foreach (Zone zone in zoneList.Values)
|
||||||
{
|
{
|
||||||
Actor a = zone.FindActorInZone(charId);
|
Actor a = zone.FindActorInZone(charId);
|
||||||
|
|
|
@ -368,15 +368,15 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
|
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(double deltaTime)
|
public void Update(DateTime tick)
|
||||||
{
|
{
|
||||||
if (this is Character)
|
if (this is Character)
|
||||||
{
|
{
|
||||||
((Character)this).Update(deltaTime);
|
((Character)this).Update(tick);
|
||||||
}
|
}
|
||||||
else if (this is Zone)
|
else if (this is Zone)
|
||||||
{
|
{
|
||||||
((Zone)this).Update(deltaTime);
|
((Zone)this).Update(tick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -526,12 +526,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(double deltaTime)
|
public void Update(DateTime tick)
|
||||||
{
|
{
|
||||||
lock (mActorList)
|
lock (mActorList)
|
||||||
{
|
{
|
||||||
foreach (Actor a in mActorList.Values)
|
foreach (Actor a in mActorList.Values)
|
||||||
a.Update(deltaTime);
|
a.Update(tick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,11 +163,11 @@ namespace FFXIVClassic_Map_Server.actors.area
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(double deltaTime)
|
public void Update(DateTime tick)
|
||||||
{
|
{
|
||||||
// todo: again, this is retarded but debug stuff
|
// todo: again, this is retarded but debug stuff
|
||||||
var diffTime = DateTime.Now - lastUpdate;
|
var diffTime = tick - lastUpdate;
|
||||||
base.Update(deltaTime);
|
base.Update(tick);
|
||||||
|
|
||||||
// arbitrary cap
|
// arbitrary cap
|
||||||
if (diffTime.Milliseconds >= 33)
|
if (diffTime.Milliseconds >= 33)
|
||||||
|
|
|
@ -221,7 +221,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(double deltaTime)
|
public void Update(DateTime tick)
|
||||||
{
|
{
|
||||||
// todo: actual ai controllers
|
// todo: actual ai controllers
|
||||||
// todo: mods to control different params instead of hardcode
|
// todo: mods to control different params instead of hardcode
|
||||||
|
@ -231,11 +231,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
|
||||||
if (aiContainer != null)
|
if (aiContainer != null)
|
||||||
{
|
{
|
||||||
this.aiContainer.Update(DateTime.Now);
|
this.aiContainer.Update(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var diffTime = (DateTime.Now - lastAiUpdate);
|
var diffTime = (tick - lastAiUpdate);
|
||||||
|
|
||||||
if (this is Player)
|
if (this is Player)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +248,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
// todo: this too
|
// todo: this too
|
||||||
if (diffTime.Milliseconds >= deltaTime)
|
if (diffTime.Milliseconds >= 10)
|
||||||
{
|
{
|
||||||
bool foundActor = false;
|
bool foundActor = false;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
}
|
}
|
||||||
|
|
||||||
// time elapsed since last move update
|
// time elapsed since last move update
|
||||||
var diffMove = (DateTime.Now - lastMoveUpdate);
|
var diffMove = (tick - lastMoveUpdate);
|
||||||
|
|
||||||
// todo: modifier for DelayBeforeRoamToSpawn
|
// todo: modifier for DelayBeforeRoamToSpawn
|
||||||
// player disappeared
|
// player disappeared
|
||||||
|
|
|
@ -46,6 +46,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DateTime GetLatestUpdate()
|
||||||
|
{
|
||||||
|
return latestUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
public void Engage(Character target)
|
public void Engage(Character target)
|
||||||
{
|
{
|
||||||
if (controller != null)
|
if (controller != null)
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
||||||
|
|
||||||
protected DateTime startTime;
|
protected DateTime startTime;
|
||||||
|
|
||||||
protected BasePacket errorPacket;
|
protected SubPacket errorPacket;
|
||||||
|
|
||||||
public State(Character owner, Character target)
|
public State(Character owner, Character target)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,13 +8,13 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
|
||||||
{
|
{
|
||||||
static class AttackUtils
|
static class AttackUtils
|
||||||
{
|
{
|
||||||
public static int CalculateDamage(ref Character attacker, ref Character defender)
|
public static int CalculateDamage(Character attacker, Character defender)
|
||||||
{
|
{
|
||||||
int dmg = CalculateBaseDamage(ref attacker, ref defender);
|
int dmg = CalculateBaseDamage(attacker, defender);
|
||||||
|
|
||||||
return dmg;
|
return dmg;
|
||||||
}
|
}
|
||||||
public static int CalculateBaseDamage(ref Character attacker, ref Character defender)
|
public static int CalculateBaseDamage(Character attacker, Character defender)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,8 +396,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
player.QueuePacket(PlayBGAnimation.BuildPacket(actorId, player.actorId, animationName));
|
player.QueuePacket(PlayBGAnimation.BuildPacket(actorId, player.actorId, animationName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(double deltaTime)
|
public void Update(DateTime tick)
|
||||||
{
|
{
|
||||||
|
var deltaTime = (tick - aiContainer.GetLatestUpdate()).Milliseconds;
|
||||||
LuaEngine.GetInstance().CallLuaFunction(null, this, "onUpdate", true, deltaTime);
|
LuaEngine.GetInstance().CallLuaFunction(null, this, "onUpdate", true, deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue