Skip to content

Commit da0ff33

Browse files
committed
address feedback and implement asarium's suggestion
1 parent 8aa2f3b commit da0ff33

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

code/ship/shiphit.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "object/objectsnd.h"
4040
#include "parse/parselo.h"
4141
#include "scripting/scripting.h"
42+
#include "scripting/api/objs/subsystem.h"
4243
#include "playerman/player.h"
4344
#include "popup/popup.h"
4445
#include "render/3d.h"
@@ -113,7 +114,7 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vec3d* hitpos
113114
object *ship_objp;
114115
model_subsystem *psub;
115116
vec3d g_subobj_pos;
116-
int type, i, subsystem_index, log_index;
117+
int type, i, log_index;
117118

118119
// get some local variables
119120
sip = &Ship_info[ship_p->ship_info_index];
@@ -217,6 +218,7 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vec3d* hitpos
217218
Assert( ship_p->ship_info_index < 65535 );
218219

219220
// get the "index" of this subsystem in the ship info structure.
221+
int subsystem_index;
220222
for (subsystem_index = 0; subsystem_index < sip->n_subsystems; ++subsystem_index ) {
221223
if ( &(sip->subsystems[subsystem_index]) == psub )
222224
break;
@@ -271,11 +273,9 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vec3d* hitpos
271273

272274
// call a scripting hook for the subsystem (regardless of whether it's added to the mission log)
273275
Script_system.SetHookObject("Ship", ship_objp);
274-
Script_system.SetHookVar("SubsysName", 's', psub->name);
275-
Script_system.SetHookVar("SubobjName", 's', psub->subobj_name);
276-
Script_system.SetHookVar("SubsysIndex", 'i', subsystem_index);
276+
Script_system.SetHookVar("Subsystem", 'o', scripting::api::l_Subsystem.Set(scripting::api::ship_subsys_h(ship_objp, subsys)));
277277
Script_system.RunCondition(CHA_ONSUBSYSDEATH, ship_objp);
278-
Script_system.RemHookVars(4, "Ship", "SubsysName", "SubobjName", "SubsysIndex");
278+
Script_system.RemHookVars(2, "Ship", "Subsystem");
279279

280280
if ( psub->subobj_num > -1 ) {
281281
shipfx_blow_off_subsystem(ship_objp,ship_p,subsys,&g_subobj_pos,no_explosion);

0 commit comments

Comments
 (0)