mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Send extended entity info
This commit is contained in:
parent
1d9557de20
commit
c194c7e710
|
@ -36,6 +36,7 @@ Emoticons = ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY",
|
||||||
|
|
||||||
Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA"]
|
Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA"]
|
||||||
Authed = ["NO", "HELPER", "MOD", "ADMIN"]
|
Authed = ["NO", "HELPER", "MOD", "ADMIN"]
|
||||||
|
EntityClasses = ["PICKUP", "PROJECTILE"]
|
||||||
|
|
||||||
RawHeader = '''
|
RawHeader = '''
|
||||||
|
|
||||||
|
@ -77,6 +78,7 @@ Enums = [
|
||||||
Enum("POWERUP", Powerups),
|
Enum("POWERUP", Powerups),
|
||||||
Enum("EMOTICON", Emoticons),
|
Enum("EMOTICON", Emoticons),
|
||||||
Enum("AUTHED", Authed),
|
Enum("AUTHED", Authed),
|
||||||
|
Enum("ENTITYCLASS", EntityClasses),
|
||||||
]
|
]
|
||||||
|
|
||||||
Flags = [
|
Flags = [
|
||||||
|
@ -313,6 +315,13 @@ Objects = [
|
||||||
NetIntAny("m_Status7"),
|
NetIntAny("m_Status7"),
|
||||||
NetIntAny("m_Status8"),
|
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 = [
|
Messages = [
|
||||||
|
|
|
@ -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)
|
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);
|
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;
|
int Tick = (Server()->Tick() % Server()->TickSpeed()) % 11;
|
||||||
if(Char && Char->IsAlive() &&
|
if(Char && Char->IsAlive() &&
|
||||||
(m_Layer == LAYER_SWITCH && m_Number > 0 &&
|
(m_Layer == LAYER_SWITCH && m_Number > 0 &&
|
||||||
|
|
|
@ -300,6 +300,17 @@ void CProjectile::Snap(int SnappingClient)
|
||||||
{
|
{
|
||||||
float Ct = (Server()->Tick() - m_StartTick) / (float)Server()->TickSpeed();
|
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)))
|
if(NetworkClipped(SnappingClient, GetPos(Ct)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue