Author Topic: Request: Jettison-Cargo w/Speed  (Read 787 times)

0 Members and 1 Guest are viewing this topic.

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Request: Jettison-Cargo w/Speed
I've got a situation with one of my loop missions in FS1: Enhanced, where Shivan freighters fully loaded with cargo are to release the cargo quickly and depart.  I was hoping to use the jettison-cargo-delay sexp, but it simply releases the cargo and it gets scraped on the hull.  Is there any easy way to either modify the existing sexp or generating a new one with user-definable ejection speed so they can clear the ship?
The Trivial Psychic Strikes Again!

 

Offline 0rph3u5

  • 211
  • Stop calling me 'intelligent', I am clearly not
    • Steam
    • Twitter
Re: Request: Jettison-Cargo w/Speed
Not to cut of the feature request, but can't you achieve what you are looking for with high blast, no damage explosion-effects? (You would have to set the freighters to immobile for second or two, so they don't get tossed around)
"As a rebellion fails, a search begins."
- The Lost Generation - Ashcroft coming soon -



"...because they are not Dragons."

 

Offline The E

  • He's Ebeneezer Goode
  • Global Moderator
  • 213
  • Nothing personal, just tech support.
    • Skype
    • Steam
    • Twitter
Re: Request: Jettison-Cargo w/Speed
I've got a situation with one of my loop missions in FS1: Enhanced, where Shivan freighters fully loaded with cargo are to release the cargo quickly and depart.  I was hoping to use the jettison-cargo-delay sexp, but it simply releases the cargo and it gets scraped on the hull.  Is there any easy way to either modify the existing sexp or generating a new one with user-definable ejection speed so they can clear the ship?

Well, it would have to be ejection vector and speed, but yes, this is certainly doable.
**** every cause that ends in murder and children crying. ― Iain Banks
Join the fun at the HLP IRC channel. Get the latest spam and gossip as long as it's fresh!

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Request: Jettison-Cargo w/Speed
I felt that the vector should be down the dockpoint normals.  The speed, I felt, would need to be user-definable, because some ships would only need a slight kick, while others like the Chronos would need a more significant ejection speed to clear the hull.
The Trivial Psychic Strikes Again!

 
Re: Request: Jettison-Cargo w/Speed
How about set-object-speed and collision groups?
Excuse me for any spelling errors I make - I'm still learning English :P

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: Request: Jettison-Cargo w/Speed
Here is the code in question:

Code: [Select]
// physics stuff
vm_vec_sub(&pos, &cargo_objp->pos, &objp->pos);
impulse = pos;
vm_vec_scale(&impulse, 100.0f);
vm_vec_normalize(&pos);

// whack the ship
physics_apply_whack(&impulse, &pos, &cargo_objp->phys_info, &cargo_objp->orient, cargo_objp->phys_info.mass);

That vector is wrong; what it's doing is comparing the centers of the two ships.  It should use the dockpoint normal as Trivial Psychic says.  This explains why some cargo containers get hung up on their ships.

Furthermore, since not all dockpoints are equally distant from the centers of their host ships, the farther dockpoints will be ejected with greater force than the closer dockpoints.

The best solution is probably to write a new jettison-cargo sexp and deprecate the old one.  The new sexp should use proper physics and provide an optional argument for ejection force.  I should be able to do that tomorrow.

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Request: Jettison-Cargo w/Speed
Awesome.  Thanks.  Perhaps instead it could be called eject-cargo.
The Trivial Psychic Strikes Again!

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Request: Jettison-Cargo w/Speed
Awesome!  Thanks!  :yes:
The Trivial Psychic Strikes Again!

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Request: Jettison-Cargo w/Speed
Seems to be working fine.  Thanks again!  :yes:
The Trivial Psychic Strikes Again!

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: Request: Jettison-Cargo w/Speed
Glad to hear it. :)