Techneck/code/source-c/entity/player.c

55 lines
1.5 KiB
C
Raw Normal View History

2023-10-14 13:04:52 +00:00
#include "registration.h"
#include <stdlib.h>
tc_entity_type_s *tc_player_entity_type_g = NULL;
2023-10-15 09:51:45 +00:00
void tc_fn_create_player_entity(tc_entity_s *entity)
2023-10-14 13:04:52 +00:00
{
entity->type = tc_player_entity_type_g;
entity->location = tc_zero_location();
entity->specific = NULL;
}
void tc_fn_spawn_player_entity(tc_entity_s *entity, tc_location_s location)
{
if(entity->location.world != NULL) return;
entity->location = location;
}
void tc_fn_teleport_player_entity(tc_entity_s *entity, tc_location_s location)
{
entity->location = location;
}
void tc_fn_delete_player_entity(tc_entity_s *entity)
{
if(entity->specific != NULL) free(entity->specific);
tc_deallocate_entity(entity);
}
void tc_fn_send_event_player_entity(tc_entity_s *entity, tc_entity_event_s event)
{
}
void tc_register_player_entity()
{
tc_entity_type_s type;
type.internal_name = "player";
type.display_name = "Player";
2023-10-15 09:51:45 +00:00
type.instances_capacity = 8;
2023-10-14 13:04:52 +00:00
type.functions.fn_create = tc_fn_create_player_entity;
type.functions.fn_spawn = tc_fn_spawn_player_entity;
type.functions.fn_teleport = tc_fn_teleport_player_entity;
type.functions.fn_delete = tc_fn_delete_player_entity;
type.functions.fn_send_event = tc_fn_send_event_player_entity;
tc_register_entity_type(type);
2023-10-14 14:38:38 +00:00
tc_player_entity_type_g = tc_get_entity_type_with_name("player");
2023-10-14 13:04:52 +00:00
}