Author Topic: Request: Jettison-Cargo w/Speed  (Read 2645 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
  • Oceans rise. Empires fall.
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 you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

  

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • 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.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

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!

 

Offline Mito [PL]

  • 210
  • Proud Member of Slavicus Mechanicus
Re: Request: Jettison-Cargo w/Speed
How about set-object-speed and collision groups?
How do you kill a hydra?

You starve it to death.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 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 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
  • Moderator
  • 214
    • Goober5000 Productions
Re: Request: Jettison-Cargo w/Speed
Glad to hear it. :)