Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Shivan Hunter on January 11, 2014, 10:05:04 pm

Title: Support ships and has-undocked-delay
Post by: Shivan Hunter on January 11, 2014, 10:05:04 pm
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).

(http://i.imgur.com/OfP8i0o.png)

The has-arrived sexp returns true when Support 1 arrives, but neither of the docking ones do. Wat do
Title: Re: Support ships and has-undocked-delay
Post by: karajorma on January 11, 2014, 10:47:58 pm
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.
Title: Re: Support ships and has-undocked-delay
Post by: Goober5000 on January 12, 2014, 02:27:40 am
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. :)
Title: Re: Support ships and has-undocked-delay
Post by: karajorma on January 12, 2014, 06:06:19 am
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.
Title: Re: Support ships and has-undocked-delay
Post by: Goober5000 on January 12, 2014, 11:08:39 am
I'll implement and test the fix after I finish my work project this weekend.
Title: Re: Support ships and has-undocked-delay
Post by: Goober5000 on January 26, 2014, 01:24:59 pm
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 (http://scp.indiegames.us/builds/temp/Mantis2999.zip).