Skip to content

Instantly share code, notes, and snippets.

@Kolesias123
Last active August 29, 2015 14:08
Show Gist options
  • Save Kolesias123/c9ed897b608477f31d4d to your computer and use it in GitHub Desktop.
Save Kolesias123/c9ed897b608477f31d4d to your computer and use it in GitHub Desktop.
Entidad con físicas en Servidor
class MyEntity extends PhysicsEntity
{
int m_iPings = 0;
int m_iThinks = 0;
// Esta función es llamada cada que se quiera enviar la entidad a los clientes
void prepareDatatable()
{
myTable.add( "Pings", m_iPings );
super.prepareDatatable();
}
void think()
{
super.think();
// Agregamos un ping
if ( m_iThinks % 100 == 0 )
addPing();
// Imprimos un mensaje en la consola
++m_iThinks;
Msg("[Servidor] ¡He pensado $m_iThinks veces!");
}
void addPing()
{
++m_iPings;
// TODO
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment