fix: entities will now attack until target is unconscious
rather than until target is dead
This commit is contained in:
parent
9c96edee94
commit
5242deee1f
|
@ -5,5 +5,5 @@ requirements_dict = {
|
|||
"is_target_enemy": true
|
||||
}
|
||||
desired_state_dict = {
|
||||
"is_target_dead": true
|
||||
"is_target_unconscious": true
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ UseWeapon::UseWeapon()
|
|||
: Action() {
|
||||
this->required.insert("can_see_target", true);
|
||||
this->required.insert("is_in_range", true);
|
||||
this->effects.insert("is_target_dead", true);
|
||||
this->effects.insert("is_target_unconscious", true);
|
||||
}
|
||||
|
||||
goap::State *UseWeapon::get_apply_state(goap::ActorWorldState *context) const {
|
||||
|
|
|
@ -117,7 +117,7 @@ bool RTSPlayer::order_activate_object(gd::Node3D *node) {
|
|||
}
|
||||
Unit *unit{gd::Object::cast_to<Unit>(node)};
|
||||
if(unit && unit->get_team() == UnitTeam::Enemy) {
|
||||
this->selected_unit->set_target_goal(unit, goap::Goal::create("is_target_dead", true));
|
||||
this->selected_unit->set_target_goal(unit, goap::Goal::create("is_target_unconscious", true));
|
||||
return true;
|
||||
}
|
||||
return unit != nullptr;
|
||||
|
|
|
@ -14,7 +14,7 @@ void UnitWorldState::_bind_methods() {
|
|||
GDSIGNAL("attention_changed");
|
||||
GDFUNCTION(get_weapon_animation);
|
||||
GDFUNCTION(get_can_see_target);
|
||||
GDFUNCTION(get_is_target_dead);
|
||||
GDFUNCTION(get_is_target_unconscious);
|
||||
GDFUNCTION(get_is_at_target);
|
||||
GDFUNCTION(get_has_target);
|
||||
GDFUNCTION(get_target_node);
|
||||
|
@ -84,9 +84,9 @@ bool UnitWorldState::get_has_target() const {
|
|||
return this->target_node != nullptr;
|
||||
}
|
||||
|
||||
bool UnitWorldState::get_is_target_dead() const {
|
||||
bool UnitWorldState::get_is_target_unconscious() const {
|
||||
if(EntityHealth *health{this->target_node->get_node<EntityHealth>("%EntityHealth")})
|
||||
return health->get_injury_current() <= 0.f;
|
||||
return !health->is_conscious();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
bool get_can_see_node(gd::Node3D *node) const;
|
||||
bool get_is_at_target() const;
|
||||
bool get_has_target() const;
|
||||
bool get_is_target_dead() const;
|
||||
bool get_is_target_unconscious() const;
|
||||
bool get_is_target_unit() const;
|
||||
bool get_is_target_enemy() const;
|
||||
bool get_is_unit_enemy(Unit *unit) const;
|
||||
|
|
Loading…
Reference in a new issue