@@ -147,7 +147,8 @@ void door::unlock()
147147#endif // #ifdef DEBUG
148148}
149149
150- void door::change_state ()
150+ // Alundaio: Modified to pass the initiator to ph_door:use_callback
151+ void door::change_state (actor* initiator)
151152{
152153 VERIFY (valid (m_state));
153154 VERIFY (valid (m_target_state));
@@ -156,13 +157,14 @@ void door::change_state()
156157 if (m_state == m_target_state)
157158 return ;
158159
159- m_object.callback (GameObject::eUseObject)(m_object.lua_game_object (), (CScriptGameObject*)0 );
160+ m_object.callback (GameObject::eUseObject)(m_object.lua_game_object (), (CScriptGameObject*)initiator-> lua_game_object () );
160161#ifdef DEBUG
161162 if (g_debug_doors)
162163 Msg (" door[%s] started to change its state to [%s]" , m_object.cName ().c_str (),
163164 m_target_state == door_state_open ? " open" : " closed" );
164165#endif // #ifdef DEBUG
165166}
167+ // Alundaio: END
166168
167169void door::change_state (actor* const initiator, door_state const start_state, door_state const stop_state)
168170{
@@ -185,7 +187,7 @@ void door::change_state(actor* const initiator, door_state const start_state, do
185187 // if ( !xr_strcmp( "sim_default_duty_28212", initiator->get_name()) ) {
186188 // int i=0; (void)i;
187189 // }
188- change_state ();
190+ change_state (initiator); // Alundaio: Pass the initiator! We need to know who is trying to open door!
189191 return ;
190192 }
191193
@@ -234,7 +236,7 @@ void door::change_state(actor* const initiator, door_state const start_state, do
234236 // if ( !xr_strcmp( "sim_default_duty_28212", initiator->get_name()) ) {
235237 // int i=0; (void)i;
236238 // }
237- change_state ();
239+ change_state (initiator); // Alundaio: Pass the initiator! We need to know who is trying to open door!
238240 }
239241 else
240242 VERIFY (m_previous_state == stop_state);
@@ -267,7 +269,7 @@ void door::on_change_state(door_state const state)
267269 return ;
268270 }
269271
270- change_state ();
272+ change_state (nullptr ); // Alundaio: NULL - no need to know who
271273}
272274
273275#ifdef DEBUG
0 commit comments