#include "registration.h" #include tc_entity_type_s *tc_player_entity_type_g = NULL; tc_entity_s * tc_fn_create_player_entity() { tc_entity_s *entity = tc_allocate_entity(); entity->type = tc_player_entity_type_g; entity->location = tc_zero_location(); entity->specific = NULL; entity->num_attributes = 0; entity->attributes_capacity = 8; entity->attributes = calloc(sizeof(tc_entity_attribute_s), entity->attributes_capacity); return entity; } 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"; 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); tc_player_entity_type_g = tc_get_entity_type_with_name("player"); }