void ComponentEnemy::Initialize() { m_TransformComponent = GET_COMPONENT(ComponentTransform2D); m_RigidBodyComponent = GET_COMPONENT(ComponentRigidBody); SetScaleLevel(0); }
void PhysicsHelper::set_half_height(EntitySystem& ents, tdt::uint id, tdt::real val) { PhysicsComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, PhysicsComponent); if(comp) comp->half_height = val; }
void EventHelper::set_radius(EntitySystem& ents, std::size_t id, Ogre::Real val) { EventComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, EventComponent); if(comp) comp->radius = val; }
void OnHitHelper::set_cooldown(EntitySystem& ents, tdt::uint id, tdt::real val) { OnHitComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, OnHitComponent); if(comp) comp->cooldown = val; }
void StructureHelper::set_radius(EntitySystem& ents, tdt::uint id, tdt::uint radius) { StructureComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, StructureComponent); if(comp) comp->radius = radius; }
void TaskHelper::set_task_source(EntitySystem& ents, tdt::uint id, tdt::uint source) { TaskComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, TaskComponent); if(comp) comp->source = source; }
void TaskHelper::set_task_type(EntitySystem& ents, tdt::uint id, TASK_TYPE type) { TaskComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, TaskComponent); if(comp) comp->task_type = type; }
void TaskHelper::set_complete(EntitySystem& ents, tdt::uint id) { TaskComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, TaskComponent); if(comp) comp->complete = true; }
void CombatHelper::set_atk_type(EntitySystem& ents, tdt::uint id, ATTACK_TYPE type) { CombatComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, CombatComponent); if(comp) comp->atk_type = type; }
void CombatHelper::set_cooldown(EntitySystem& ents, tdt::uint id, tdt::real cd) { CombatComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, CombatComponent); if(comp) comp->cooldown = cd; }
void CombatHelper::set_range(EntitySystem& ents, tdt::uint id, tdt::real range) { CombatComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, CombatComponent); if(comp) comp->range = range; }
void CombatHelper::set_projectile_blueprint(EntitySystem& ents, tdt::uint id, const std::string& val) { CombatComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, CombatComponent); if(comp) comp->projectile_blueprint = val; }
void CombatHelper::set_target(EntitySystem& ents, tdt::uint id, tdt::uint val) { CombatComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, CombatComponent); if(comp) comp->curr_target = val; }
void ExplosionHelper::set_delta(EntitySystem& ents, tdt::uint id, tdt::real val) { ExplosionComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, ExplosionComponent); if(comp) comp->delta = val; }
void ExplosionHelper::increase_curr_radius(EntitySystem& ents, tdt::uint id, tdt::real val) { ExplosionComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, ExplosionComponent); if(comp) comp->curr_radius += val; }
void EventHelper::set_event_handler(EntitySystem& ents, std::size_t id, std::size_t val) { EventComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, EventComponent); if(comp) comp->handler = val; }
void EventHelper::set_event_type(EntitySystem& ents, std::size_t id, EVENT_TYPE val) { EventComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, EventComponent); if(comp) comp->event_type = val; }
static int rose_number_digits_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) { int i = 0; struct rose_component *comp = NULL; unsigned char *vdata = data; int datalen = 0; int res = 0; do { GET_COMPONENT(comp, i, vdata, len); CHECK_COMPONENT(comp, ASN1_NUMERICSTRING, "Don't know what to do with PublicPartyNumber ROSE component type 0x%x\n"); if(comp->len > 20 && comp->len != ASN1_LEN_INDEF) { pri_message(pri, "!! Oversized NumberDigits component (%d)\n", comp->len); return -1; } if (comp->len == ASN1_LEN_INDEF) { datalen = strlen((char *)comp->data); res = datalen + 2; } else res = datalen = comp->len; memcpy(value->partyaddress, comp->data, datalen); value->partyaddress[datalen] = '\0'; return res + 2; } while(0); return -1; }
void TaskHelper::set_task_target(EntitySystem& ents, tdt::uint id, tdt::uint target) { TaskComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, TaskComponent); if(comp) comp->target = target; }
static int rose_public_party_number_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) { int i = 0; struct rose_component *comp = NULL; unsigned char *vdata = data; int ton; int res = 0; if (len < 2) return -1; do { GET_COMPONENT(comp, i, vdata, len); CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Don't know what to do with PublicPartyNumber ROSE component type 0x%x\n"); ASN1_GET_INTEGER(comp, ton); NEXT_COMPONENT(comp, i); ton = typeofnumber_for_q931(pri, ton); res = rose_number_digits_decode(pri, call, &vdata[i], len-i, value); if (res < 0) return -1; value->ton = ton; return res + 3; } while(0); return -1; }
void TaskHelper::add_task(EntitySystem& ents, tdt::uint ent_id, tdt::uint task_id, bool priority) { auto comp1 = ents.get_component<TaskHandlerComponent>(ent_id); TaskComponent* comp2{nullptr}; GET_COMPONENT(task_id, ents, comp2, TaskComponent); if(comp1 && comp2) { // Make sure the entity can handle this task. if(!comp1->possible_tasks.test((int)comp2->task_type)) return; comp2->source = ent_id; if(priority) { if(comp1->curr_task != Component::NO_ENTITY) { comp1->task_queue.push_front(comp1->curr_task); comp1->curr_task = Component::NO_ENTITY; } comp1->task_queue.push_front(task_id); comp1->busy = false; } else comp1->task_queue.push_back(task_id); } }
void OnHitHelper::set_blueprint(EntitySystem& ents, tdt::uint id, const std::string& val) { OnHitComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, OnHitComponent); if(comp) comp->blueprint = val; }
void StructureHelper::add_residence(EntitySystem& ents, tdt::uint id, tdt::uint node_id) { StructureComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, StructureComponent); if(comp) comp->residences.push_back(node_id); }
void EventHelper::set_active(EntitySystem& ents, std::size_t id, bool val) { EventComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, EventComponent); if(comp) comp->active = val; }
void LimitedLifeSpanHelper::set_max_time(EntitySystem& ents, tdt::uint id, tdt::real val) { LimitedLifeSpanComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, LimitedLifeSpanComponent); if(comp) comp->max_time = val; }
void PhysicsHelper::set_solid(EntitySystem& ents, tdt::uint id, bool val) { PhysicsComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, PhysicsComponent); if(comp) comp->solid = val; }
void StructureHelper::set_walk_through(EntitySystem& ents, tdt::uint id, bool on_off) { StructureComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, StructureComponent); if(comp) comp->walk_through = on_off; }
tdt::real LimitedLifeSpanHelper::get_curr_time(EntitySystem& ents, tdt::uint id) { LimitedLifeSpanComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, LimitedLifeSpanComponent); if(comp) return comp->curr_time; else return tdt::real{}; }
bool StructureHelper::is_walk_through(EntitySystem& ents, tdt::uint id) { StructureComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, StructureComponent); if(comp) return comp->walk_through; else return true; }
tdt::uint StructureHelper::get_radius(EntitySystem& ents, tdt::uint id) { StructureComponent* comp{nullptr}; GET_COMPONENT(id, ents, comp, StructureComponent); if(comp) return comp->radius; else return tdt::uint{}; }