Skip to content

Commit 9eb0a68

Browse files
revolucasXottab-DUTY
authored andcommitted
+ Added sanity checks to a couple actions that should verify if enemy/danger object actually exists before executing since it's possible these can become NULL between the time the evaluator is ran and the action is executed
+ Added a condition check to see if member is visible_now before transfering enemy through CAI_Stalker::process_enemies to prevent omniscient detection * Changed ERROR to WARNING when an object is transfered to a new inventory owner when it doesn't have a parent
1 parent 599df0e commit 9eb0a68

7 files changed

+50
-5
lines changed

src/xrGame/ai/stalker/ai_stalker_misc.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ void CAI_Stalker::process_enemies()
203203
continue;
204204
}
205205

206+
//Alundaio: Only transfer enemy if I can see member at this very moment!
207+
if (!memory().visual().visible_now(member))
208+
continue;
209+
//Alundaio: END
210+
206211
memory().make_object_visible_somewhen(member->memory().enemy().selected());
207212
found = true;
208213
break;

src/xrGame/alife_online_offline_group.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,25 @@ void CSE_ALifeOnlineOfflineGroup::force_change_position(Fvector position)
366366
// m_tGraphID = new_graph_vertex;
367367
}
368368

369+
//Alundaio: force new graph location
370+
/*
371+
void CSE_ALifeOnlineOfflineGroup::force_change_game_vertex_id(u32 game_vertex_id)
372+
{
373+
if (game_vertex_id && ai().game_graph().valid_vertex_id(game_vertex_id))
374+
{
375+
const CGameGraph::CVertex vertex = *ai().game_graph().vertex(game_vertex_id);
376+
m_tNodeID = vertex.level_vertex_id;
377+
o_Position = vertex.level_point;
378+
379+
if (m_tGraphID != game_vertex_id)
380+
{
381+
alife().graph().change(this, m_tGraphID, game_vertex_id);
382+
}
383+
}
384+
}
385+
*/
386+
//Alundaio: END
387+
369388
void CSE_ALifeOnlineOfflineGroup::on_failed_switch_online()
370389
{
371390
MEMBERS::const_iterator I = m_members.begin();

src/xrGame/stalker_combat_actions.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,10 @@ void CStalkerActionDetourEnemy::initialize()
784784
object().agent_manager().member().member(m_object).cover(0);
785785

786786
//#ifndef SILENT_COMBAT
787-
if (object().memory().enemy().selected()->human_being() && object().agent_manager().member().group_behaviour())
788-
// object().sound().play (eStalkerSoundNeedBackup);
787+
//Alundaio: Sanity
788+
if (object().memory().enemy().selected() && object().memory().enemy().selected()->human_being() && object().agent_manager().member().group_behaviour())
789+
//Alundaio: END
790+
//object().sound().play(eStalkerSoundNeedBackup);
789791
object().sound().play(eStalkerSoundDetour);
790792
//#endif
791793
}
@@ -806,6 +808,11 @@ void CStalkerActionDetourEnemy::execute()
806808

807809
inherited::execute();
808810

811+
//Alundaio: Sanity
812+
if (!object().memory().enemy().selected())
813+
return;
814+
//Alundaio: END
815+
809816
CMemoryInfo mem_object = object().memory().memory(object().memory().enemy().selected());
810817

811818
if (!mem_object.m_object)
@@ -1009,8 +1016,10 @@ void CStalkerActionSuddenAttack::execute()
10091016

10101017
inherited::execute();
10111018

1012-
if (object().agent_manager().member().combat_members().size() > 1)
1013-
m_storage->set_property(eWorldPropertyUseSuddenness, false);
1019+
//Alundaio: Removed check to allow stalkers to sneak up on enemy even if they are in a squad; most likely removed because of friendly fire but not an issue with rx_ff scheme
1020+
//if (object().agent_manager().member().combat_members().size() > 1)
1021+
// m_storage->set_property(eWorldPropertyUseSuddenness, false);
1022+
//Alundaio: END
10141023

10151024
if (!object().memory().enemy().selected())
10161025
return;
@@ -1133,6 +1142,11 @@ void CStalkerActionKillEnemyIfPlayerOnThePath::execute()
11331142

11341143
inherited::execute();
11351144

1145+
//Alundaio: Sanity
1146+
if (!object().memory().enemy().selected())
1147+
return;
1148+
//Alundaio: END
1149+
11361150
object().sight().setup(CSightAction(object().memory().enemy().selected(), true, true));
11371151

11381152
fire();

src/xrGame/stalker_danger_in_direction_actions.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ void CStalkerActionDangerInDirectionLookOut::execute()
145145
{
146146
inherited::execute();
147147

148+
//Alundaio: This action should verify the danger object exists; sanity
149+
if (!object().memory().danger().selected())
150+
return;
151+
//Alundaio: END
152+
148153
// CMemoryInfo mem_object =
149154
// object().memory().memory(object().memory().danger().selected()->object());
150155
//

src/xrGame/xrServer_process_event_reject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool xrServer::Process_event_reject(
4242
xr_vector<u16>::iterator c = std::find(C.begin(), C.end(), id_entity);
4343
if (c == C.end())
4444
{
45-
Msg("! ERROR: SV: can't find children [%d] of parent [%d]", id_entity, e_parent);
45+
Msg("! WARNING: SV: can't find children [%d] of parent [%d]", id_entity, e_parent);
4646
return false;
4747
}
4848

src/xrServerEntities/xrServer_Objects_ALife_Monsters.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ class CSE_ALifeOnlineOfflineGroup : public CSE_ALifeDynamicObject,
720720
void clear_location_types();
721721
void add_location_type(LPCSTR mask);
722722
void force_change_position(Fvector position);
723+
//void force_change_game_vertex_id(u32 game_vertex_id);
723724
virtual void on_failed_switch_online();
724725
#else
725726
public:

src/xrServerEntities/xrserver_objects_alife_monsters_script3.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static void CSE_ALifeOnlineOfflineGroup_Export(lua_State* luaState)
6363
.def("add_location_type", &CSE_ALifeOnlineOfflineGroup::add_location_type)
6464
.def("clear_location_types", &CSE_ALifeOnlineOfflineGroup::clear_location_types)
6565
.def("force_change_position", &CSE_ALifeOnlineOfflineGroup::force_change_position)
66+
//.def("force_change_game_vertex_id", &CSE_ALifeOnlineOfflineGroup::force_change_game_vertex_id)
6667
#endif
6768
];
6869
}

0 commit comments

Comments
 (0)