Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/scripting/global_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ const std::shared_ptr<Hook<ShipDepartConditions>> OnShipDepart = Hook<ShipDepart
{
{"Ship", "ship", "The ship departing the mission"},
{"JumpNode", "string", "The name of the jump node the ship was in when it departed. Can be nil."},
{"Method", "ship", "The name of the method the ship used to depart. One of: 'SHIP_DEPARTED', 'SHIP_DEPARTED_WARP', 'SHIP_DEPARTED_BAY', 'SHIP_VANISHED', 'SHIP_DEPARTED_REDALERT'."},
{"Method", "string", "The name of the method the ship used to depart. One of: 'SHIP_DEPARTED_WARP', 'SHIP_DEPARTED_BAY', 'SHIP_VANISHED', 'SHIP_DEPARTED_REDALERT'. Older builds sent 'SHIP_DEPARTED' for warp and bay departures; it is no longer sent."},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIP_DEPARTED should not be deleted from the list. It was a possible value before, and it may be a possible value in the future. Script authors should still be aware of the value.

});

const std::shared_ptr<Hook<WeaponDeathConditions>> OnWeaponDelete = Hook<WeaponDeathConditions>::Factory("On Weapon Delete",
Expand Down
8 changes: 6 additions & 2 deletions code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8927,7 +8927,7 @@ static void ship_actually_depart_helper(object *objp, dock_function_info *infop)
// do standard departure stuff first
objp->flags.set(Object::Object_Flags::Should_be_dead);
if (objp->type == OBJ_SHIP)
ship_cleanup(objp->instance, infop->parameter_variables.bool_value ? SHIP_VANISHED : SHIP_DEPARTED);
ship_cleanup(objp->instance, infop->parameter_variables.int_value);

// do the end-mission stuff if it's the player ship
if (objp == Player_obj)
Expand All @@ -8939,8 +8939,12 @@ static void ship_actually_depart_helper(object *objp, dock_function_info *infop)
*/
void ship_actually_depart(int shipnum, int method)
{
Assertion(method & (SHIP_DEPARTED | SHIP_VANISHED | SHIP_DEPARTED_REDALERT),
"Invalid departure method '%i' passed to ship_actually_depart for ship %s!", method, Ships[shipnum].ship_name);

Comment on lines +8942 to +8944

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion isn't needed because nothing in this function depends on it, and ship_cleanup already asserts

dock_function_info dfi;
dfi.parameter_variables.bool_value = (method == SHIP_VANISHED ? true:false);
dfi.parameter_variables.int_value = method;

dock_evaluate_all_docked_objects(&Objects[Ships[shipnum].objnum], &dfi, ship_actually_depart_helper);

// in a couple of cases we'll need to send a packet to update clients
Expand Down
Loading