Synchronize Damage Feature (#8305)

- Added a new monster stat "ClientAttackMotion" to mob_db.yml which is the time from when a monster attacks until which the damage shows on the client at 1x speed
- Added a new config synchronize_damage; when set to "yes", the client will display the damage of normal monster attacks at the exact time it is applied on the server, removing position lag (fixes #259)

Special thanks to all people who worked together to make this possible.

Co-authored-by: aleos, Lemongrass3110, Atemo
This commit is contained in:
Playtester
2024-05-25 18:59:22 +02:00
committed by GitHub
parent 023263df7d
commit b4ae40d401
13 changed files with 3419 additions and 15 deletions

View File

@@ -4461,6 +4461,7 @@ s_mob_db::s_mob_db()
status.speed = DEFAULT_WALK_SPEED;
status.adelay = cap_value(0, battle_config.monster_max_aspd * 2, 4000);
status.amotion = cap_value(0, battle_config.monster_max_aspd, 2000);
status.clientamotion = cap_value(status.amotion, 1, USHRT_MAX);
status.mode = static_cast<e_mode>(MONSTER_TYPE_06);
vd.class_ = id;
@@ -4884,6 +4885,18 @@ uint64 MobDatabase::parseBodyNode(const ryml::NodeRef& node) {
mob->status.amotion = cap_value(speed, battle_config.monster_max_aspd, 2000);
}
if (this->nodeExists(node, "ClientAttackMotion")) {
uint16 speed;
if (!this->asUInt16(node, "ClientAttackMotion", speed))
return 0;
mob->status.clientamotion = cap_value(speed, 1, USHRT_MAX);
} else {
if (!exists)
mob->status.clientamotion = cap_value(mob->status.amotion, 1, USHRT_MAX);
}
if (this->nodeExists(node, "DamageMotion")) {
uint16 speed;