Use the right packet for when a player falls out of the world

SUDDEN_DEAD is more appropriate than goo damage for this.
Also made it so other players can see when someone does a /health 0, for
comedic effect.
This commit is contained in:
dongresource 2021-03-09 21:23:57 +01:00
parent f5a34b9a3d
commit 89eb0b140b
2 changed files with 21 additions and 4 deletions

View File

@ -1002,8 +1002,16 @@ void MobManager::playerTick(CNServer *serv, time_t currTime) {
}
// check if the player has fallen out of the world
if (plr->z < -30000)
dealGooDamage(sock, PC_MAXHEALTH(36) * 2);
if (plr->z < -30000) {
INITSTRUCT(sP_FE2CL_PC_SUDDEN_DEAD, dead);
dead.iPC_ID = plr->iID;
dead.iDamage = plr->HP;
dead.iHP = plr->HP = 0;
sock->sendPacket((void*)&dead, P_FE2CL_PC_SUDDEN_DEAD, sizeof(sP_FE2CL_PC_SUDDEN_DEAD));
PlayerManager::sendToViewable(sock, (void*)&dead, P_FE2CL_PC_SUDDEN_DEAD, sizeof(sP_FE2CL_PC_SUDDEN_DEAD));
}
if (transmit) {
INITSTRUCT(sP_FE2CL_REP_PC_TICK, pkt);

View File

@ -733,8 +733,6 @@ void PlayerManager::setValuePlayer(CNSocket* sock, CNPacketData* data) {
case 5:
plr->money = setData->iSetValue;
break;
default:
break;
}
response.iPC_ID = setData->iPC_ID;
@ -742,6 +740,17 @@ void PlayerManager::setValuePlayer(CNSocket* sock, CNPacketData* data) {
response.iSetValueType = setData->iSetValueType;
sock->sendPacket((void*)&response, P_FE2CL_GM_REP_PC_SET_VALUE, sizeof(sP_FE2CL_GM_REP_PC_SET_VALUE));
// if one lowers their own health to 0, make sure others can see it
if (plr->HP <= 0) {
INITSTRUCT(sP_FE2CL_PC_SUDDEN_DEAD, dead);
dead.iPC_ID = plr->iID;
dead.iDamage = plr->HP;
dead.iHP = plr->HP = 0;
sendToViewable(sock, (void*)&dead, P_FE2CL_PC_SUDDEN_DEAD, sizeof(sP_FE2CL_PC_SUDDEN_DEAD));
}
}
void PlayerManager::heartbeatPlayer(CNSocket* sock, CNPacketData* data) {