@@ -13935,27 +13935,27 @@ void sexp_set_friendly_damage_caps(int n) {
1393513935 * Sets the player's target to the specified, either ship, and or the subsystem on said ship.
1393613936 */
1393713937void sexp_set_player_target(int node)
13938- {
13939- int shipnum = ship_name_lookup(CTEXT(node), 1);
13938+ {
13939+ const ship_registry_entry *ship_entry = eval_ship(node);
13940+ if (ship_entry == nullptr)
13941+ return;
13942+
13943+ int shipnum = ship_entry->shipnum;
1394013944 if (shipnum < 0)
1394113945 return;
13946+
1394213947 ship* shipp = &Ships[shipnum];
1394313948 int objnum = shipp->objnum;
1394413949 int n = CDR(node);
13950+ ship_subsys * new_subsys = nullptr;
1394513951 if (n >= 0) {
1394613952 const char* subsys_name = CTEXT(n);
1394713953 if (stricmp(subsys_name, SEXP_NONE_STRING) != 0) {
13948- ship_subsys* ss = ship_get_subsys(shipp, subsys_name);
13949- // target ship regardless of whether subsystem is destroyed
13950- shipp->last_targeted_subobject[Player_num] = ss;
13951- } else {
13952- shipp->last_targeted_subobject[Player_num] = nullptr;
13954+ new_subsys = ship_get_subsys(shipp, subsys_name);
1395313955 }
13954- } else {
13955- shipp->last_targeted_subobject[Player_num] = nullptr;
1395613956 }
13957- // set_target_objnum will call hud_restore_subsystem_target which reads last_targeted_subobject
13958- set_target_objnum (Player_ai, objnum);
13957+ set_target_objnum(Player_ai, objnum);
13958+ set_targeted_subsys (Player_ai, new_subsys , objnum);
1395913959}
1396013960
1396113961// Luytenky
0 commit comments