Author Topic: Support ships and has-undocked-delay  (Read 2586 times)

0 Members and 1 Guest are viewing this topic.

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Support ships and has-undocked-delay
So I wasn't sure whether to put this in here or the SCP board since I suspect it might be a bug. If you guys confirm that I'm not doing anything wrong here I'll just Mantis it.

Test mission: http://pastebin.com/Zf7fukUh

(I was playing around with the order of <argument> and Alpha 1 in the first two parameters - it doesn't work either way).



The has-arrived sexp returns true when Support 1 arrives, but neither of the docking ones do. Wat do

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Support ships and has-undocked-delay
Yeah, just explained this one on IRC. The support ship docking to the player isn't written to the mission event log. Therefore the SEXP can't find out that it happens. This is probably very easily fixed but I'd like to know if anyone can tell me if there is any reason I haven't considered why support ship docking shouldn't be written to the log.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

  

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: Support ships and has-undocked-delay
I can't be certain, but I suspect it was one of those quick fixes in the development cycle, where the :v: guys just implemented a straightforward fix instead of looking closely at the deeper issue.  (Something that still happens from time to time in the SCP.)  It's caused by the different ways support ships dock.

Support ships have a unique "has-docked" mode, called AIS_DOCK_4.  Everybody else uses AIS_DOCK_4A.  (Yes, that seems backwards.)  The difference is that AIS_DOCK_4A lasts for only one frame before the AI exits that mode.  In contrast, AIS_DOCK_4 lasts for as long as a ship is repaired.

The mission log is only written in AIS_DOCK_4A.  There are two possibilities: either :v: forgot to replicate the mission log in AIS_DOCK_4, or they did implement it but then took it out.  This is because, since AIS_DOCK_4 is processed every frame, you'd get the mission log written every frame and pretty soon your mission log would fill up with dock entries.

To fix this, you would have to add the log in such a way that it's only called once.  This could probably be accomplished by putting it in the same if() statement as the REPAIR_INFO_BEGIN call.

(This is all guesstimating, by the way.  I peeked at the code, but didn't run any tests.)

In actual answer to your question, no, I can't see or think of any reason why support ship docking shouldn't be logged. :)

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Support ships and has-undocked-delay
Well you do know more about the docking code than me from the looks of it. So it's probably better to leave this one to you.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: Support ships and has-undocked-delay
I'll implement and test the fix after I finish my work project this weekend.

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: Support ships and has-undocked-delay
Actually, now I'm wondering about the undock entry:
Code: [Select]
// don't add undock log entries for support ships.
if ( !(sip->flags & SIF_SUPPORT) ) {
mission_log_add_entry(LOG_SHIP_UNDOCKED, shipp->ship_name, goal_shipp->ship_name);
}

It specifically excludes support ships from the log, and the undock code isn't subject to the same gotcha as the dock code.  So there must be some other reason.  It could be as simple as not wanting entries to clutter up the log.

EDIT: Test build for adding both dock and undock entries is here.
« Last Edit: January 26, 2014, 01:43:21 pm by Goober5000 »