improve player init
parent
94c49e770b
commit
eccaa14bda
|
@ -19,9 +19,7 @@ uint64_t player_spawn(char *name) {
|
|||
|
||||
ecs_set_name(world_ecs(), e, name);
|
||||
ecs_set(world_ecs(), e, ClientInfo, {0});
|
||||
ecs_set(world_ecs(), e, Inventory, {0});
|
||||
ecs_set(world_ecs(), e, Health, {.hp = PLAYER_MAX_HP, .max_hp = PLAYER_MAX_HP});
|
||||
ecs_set(world_ecs(), e, HealthRegen, {.amt = 15.0f});
|
||||
ecs_set(world_ecs(), e, Velocity, { 0 });
|
||||
ecs_set(world_ecs(), e, PhysicsBody, { .kind = PHYS_AABB, .mass = INFINITE_MASS });
|
||||
Input *i = ecs_get_mut(world_ecs(), e, Input);
|
||||
|
|
|
@ -14,7 +14,8 @@ void game_render() {
|
|||
|
||||
|
||||
void game_player_joined(uint64_t ent) {
|
||||
|
||||
ecs_set(world_ecs(), ent, Inventory, {0});
|
||||
ecs_set(world_ecs(), ent, HealthRegen, {15.f});
|
||||
}
|
||||
|
||||
void game_player_departed(uint64_t ent) {
|
||||
|
|
|
@ -21,7 +21,7 @@ void mob_systems(ecs_world_t *ecs) {
|
|||
|
||||
//NOTE(DavoSK): weapons
|
||||
ecs_mobpos_query = ecs_query_new(world_ecs(), "components.Mob, components.Position, components.Health, components.Velocity");
|
||||
ECS_SYSTEM_TICKED(ecs, WeaponKnifeMechanic, EcsPostUpdate, components.WeaponKnife, components.Position, components.Input);
|
||||
ECS_SYSTEM_TICKED(ecs, WeaponKnifeMechanic, EcsPostUpdate, components.WeaponKnife, components.Position, components.Input, !components.Dead);
|
||||
ECS_SYSTEM_TICKED(ecs, WeaponProjectileHit, EcsPostUpdate, components.WeaponProjectile, components.Position, components.Rotation);
|
||||
ECS_SYSTEM_TICKED(ecs, WeaponProjectileExpire, EcsPostUpdate, components.WeaponProjectile, components.Position);
|
||||
ECS_OBSERVER(ecs, MobOnDead, EcsOnAdd, components.Mob, components.Dead);
|
||||
|
|
|
@ -53,8 +53,8 @@ void MobMovement(ecs_iter_t *it) {
|
|||
}
|
||||
}
|
||||
|
||||
#define MOB_MELEE_DIST 4000.0f
|
||||
#define MOB_MELEE_DMG 1.5f
|
||||
#define MOB_MELEE_DIST 8000.0f
|
||||
#define MOB_MELEE_DMG 8.5f
|
||||
#define MOB_ATK_DELAY 10
|
||||
|
||||
void MobMeleeAtk(ecs_iter_t *it) {
|
||||
|
@ -76,8 +76,8 @@ void MobMeleeAtk(ecs_iter_t *it) {
|
|||
if (range < MOB_MELEE_DIST) {
|
||||
Health *health = ecs_get_mut_ex(it->world, m->plr, Health);
|
||||
health->dmg += MOB_MELEE_DMG;
|
||||
mob[i].atk_delay = MOB_ATK_DELAY;
|
||||
}
|
||||
mob[i].atk_delay = MOB_ATK_DELAY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue