Send extended entity info

This commit is contained in:
trml 2021-08-31 00:05:56 +02:00
parent 1d9557de20
commit c194c7e710
3 changed files with 28 additions and 0 deletions

View file

@ -36,6 +36,7 @@ Emoticons = ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY",
Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA"]
Authed = ["NO", "HELPER", "MOD", "ADMIN"]
EntityClasses = ["PICKUP", "PROJECTILE"]
RawHeader = '''
@ -77,6 +78,7 @@ Enums = [
Enum("POWERUP", Powerups),
Enum("EMOTICON", Emoticons),
Enum("AUTHED", Authed),
Enum("ENTITYCLASS", EntityClasses),
]
Flags = [
@ -313,6 +315,13 @@ Objects = [
NetIntAny("m_Status7"),
NetIntAny("m_Status8"),
]),
# Switch info for map items
NetObjectEx("EntityEx", "entity-ex@netobj.ddnet.tw", [
NetIntAny("m_SwitchNumber"),
NetIntAny("m_Layer"),
NetIntAny("m_EntityClass"),
]),
]
Messages = [

View file

@ -159,6 +159,14 @@ void CPickup::Snap(int SnappingClient)
if(SnappingClient > -1 && (GameServer()->m_apPlayers[SnappingClient]->GetTeam() == -1 || GameServer()->m_apPlayers[SnappingClient]->IsPaused()) && GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID != SPEC_FREEVIEW)
Char = GameServer()->GetPlayerChar(GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID);
CNetObj_EntityEx *pEntData = static_cast<CNetObj_EntityEx *>(Server()->SnapNewItem(NETOBJTYPE_ENTITYEX, GetID(), sizeof(CNetObj_EntityEx)));
if(!pEntData)
return;
pEntData->m_SwitchNumber = m_Number;
pEntData->m_Layer = m_Layer;
pEntData->m_EntityClass = ENTITYCLASS_PICKUP;
int Tick = (Server()->Tick() % Server()->TickSpeed()) % 11;
if(Char && Char->IsAlive() &&
(m_Layer == LAYER_SWITCH && m_Number > 0 &&

View file

@ -300,6 +300,17 @@ void CProjectile::Snap(int SnappingClient)
{
float Ct = (Server()->Tick() - m_StartTick) / (float)Server()->TickSpeed();
if(m_LifeSpan == -2)
{
CNetObj_EntityEx *pEntData = static_cast<CNetObj_EntityEx *>(Server()->SnapNewItem(NETOBJTYPE_ENTITYEX, GetID(), sizeof(CNetObj_EntityEx)));
if(!pEntData)
return;
pEntData->m_SwitchNumber = m_Number;
pEntData->m_Layer = m_Layer;
pEntData->m_EntityClass = ENTITYCLASS_PROJECTILE;
}
if(NetworkClipped(SnappingClient, GetPos(Ct)))
return;