[MOD/BUGFIX] Engineer Drone Fix

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

[MOD/BUGFIX] Engineer Drone Fix

Post by w.evans » Mon, 2. Feb 15, 13:50

In testing Station Engineers, verified that the vanilla issue causing docked Construction URVs to not be marked available was indeed causing the Engineers to do all subsequent repairs at a much slower rate because they were no longer counting these Construction URVs.

This is a tiny workaround to fix the vanilla issue with engineers not using Construction URVs that are not marked available upon docking, or that fail to dock.

It works simply by having Engineers count Construction URVs that are in usage by the ship or station in which they work, regardless of whether the drones are marked available or unavailable.

_____
18.Feb.2015 - v0.04 is up!

3 updates in twenty minutes! Really should stop doing this until after I've gotten at least two pots of coffee in me.

Another slight change to improve compatibility. (Thanks, Marvin Martian!)

........
18.Feb.2015 - v0.03 is up!

Slightly changed the code resulting in slightly fatter code but much improved compatibility, better than that in v0.02. (Thanks, Marvin Martian!)

........
18.Feb.2015 - v0.02 is up!

Slightly changed the code resulting in slightly fatter code but much improved compatibility. (Thanks, Marvin Martian!)

_____
The mod, in its entirety, as of v0.04 is:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="/aiscript/attention/actions/do_if[@value='$repairratefactor == 0']">
		<do_if value="($repairratefactor lt 1) and ($Defensible.units.{unitcategory.welder}.count ge 1)">
			<set_value name="$repairratefactor" exact="$Defensible.units.{unitcategory.welder}.count" />
		</do_if>
	</add>
</diff>
in aiscripts\engineer.ai.xml

_____
The file is available for download here:

http://www.nexusmods.com/xrebirth/mods/444/?

_____
Note on Compatibility: denison10 (angel618 on Steam) recently incorporated this code into his mod, Engineer 100%, with my permission. This effectively breaks compatibility between Engineer Drone Fix and Engineer 100%. Please do not install both of them at the same time.

This mod is current, but likely unnecessary, as of X:R 4.00
Compatible with X:R 3.61

Compatible with Windows, Linux, and Mac versions of X Rebirth.

_____
Check out my other mods for X Rebirth:
MarineRebalance,
BetterAutoAim,
SmalltalkHack,
Epic Capital Ship Shields,
Station Engineers,
Slightly More Useful Plot Station,
DockAllDrones,
Miscellaneous OOZ Combat Tweaks,
Miscellaneous IZ Combat Tweaks,
DifficultyHack
Last edited by w.evans on Tue, 1. Mar 16, 08:17, edited 17 times in total.

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Mon, 2. Feb 15, 14:35

Hi w.evans,
Thanks again to all your work on this game.

A question: this fix isn't already on Station Engineer mod? What can I expect when using both?

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Mon, 2. Feb 15, 14:39

Hey Rubini,

I did NOT include this fix with Station Managers. So you could use one, or the other, or both together.

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Mon, 2. Feb 15, 15:46

w.evans wrote:Hey Rubini,

I did NOT include this fix with Station Managers. So you could use one, or the other, or both together.
Ok. But, as far I can understand, the Station Engineer mod already boost and allows some automatic hull&surface repairs now on stations. With this fix these repairs will be then yet more quick? I´m asking thsi because alexalsp said that the Satation Engineer is yet a bit slower. I´m a bit confusing because I have not any scenary to test this new behaviour now.

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Mon, 2. Feb 15, 15:50

Good catch :) Hope we'll see this in vanilla soon.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Mon, 2. Feb 15, 15:51

@Rubini, In vanilla, you can't assign engineers to stations. Station repairs to player-owned stations are done via the architect in the attached construction vessel. But the station repair code is there, and used by NPC stations which do have engineers working on them.

Station Engineers just makes it possible to assign engineers to stations.

Engineer Drone Fix is an attempt to do a workaround for a bug. The bug is that after launching Construction drones once, all ships and stations cannot ever use them again, so all repairs after the first one are very slow.

@Yorrick, Thanks! It's still a workaround. Would hope that they do a proper fix in vanilla. (Make construction urvs available after they dock.)

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Mon, 2. Feb 15, 16:03

w.evans wrote:@Rubini, In vanilla, you can't assign engineers to stations. Station repairs to player-owned stations are done via the architect in the attached construction vessel. But the station repair code is there, and used by NPC stations which do have engineers working on them.

Station Engineers just makes it possible to assign engineers to stations.

Engineer Drone Fix is an attempt to do a workaround for a bug. The bug is that after launching Construction drones once, all ships and stations cannot ever use them again, so all repairs after the first one are very slow.

@Yorrick, Thanks! It's still a workaround. Would hope that they do a proper fix in vanilla. (Make construction urvs available after they dock.)
Thanks mate!
I just finish to read the Station Engineer thread all over and now I can understand well all this issue. Well done! This was a frequent issue on the forums that now we have a workaround. Great!

D.O.S.
Posts: 403
Joined: Wed, 6. Nov 02, 20:31
x4

Post by D.O.S. » Mon, 2. Feb 15, 19:14

Hi w.evans

Will this mod also fix shipyards not reseting there construction drones ?

The shipyard drone bug is the only one i have to save edit to correct
OS:MS Windows 10 Pro x64 / Cpu: AMD-FX Piledriver 8350 @4.0Ghz / Mb:GA-990FXA-UD3 / Memory:16Gb DDR3 Crucial Ballistix Tactical @1866
Gpu:Gigabyte Nvidia 770GTX 4GB GDDR5 / Storage:Crucial RealSSD M4 128GB System, WD Caviar Green 2TB HD Data & Games / Display:24" Asus VG248 1920 x 1080 @144Hz + Nvidia 3D Vision Kit
Input Devices:Razer Deathstalker / Razer Oruoboros / Thrustmaster Hotas Warthog / BroadBand:EE 4GEE MobileBroadBand (50Gb PCM)

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Mon, 2. Feb 15, 21:21

Hey DOS,

If they're run by the engineer script, it should. I suspect that they probably aren't run by the engineer script, though.

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Tue, 3. Feb 15, 01:53

D.O.S. wrote:Hi w.evans

Will this mod also fix shipyards not reseting there construction drones ?

The shipyard drone bug is the only one i have to save edit to correct
If so, then this could be a good thing to mod/fix. Humm...w.evans? 8)

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Tue, 3. Feb 15, 02:07

Rubini wrote:If so, then this could be a good thing to mod/fix. Humm...w.evans? 8)
Ha! You do it, Rubini! About time you release something yourself!

I'll help.

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Tue, 3. Feb 15, 02:45

w.evans wrote:
Rubini wrote:If so, then this could be a good thing to mod/fix. Humm...w.evans? 8)
Ha! You do it, Rubini! About time you release something yourself!

I'll help.
No... :lol: I´m not ready. I yet need to know a lot of things before seriously mod something. I´m not familiar with the folers sctructures, neither the language, don´t know yet about good tools to check things, even don´t know how to look/enable the debug text stuff. And the worst thing: if i do mod seriously some game again my wife you throw my PC by the window! :P

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Tue, 3. Feb 15, 02:51

Rubini wrote:And the worst thing: if i do mod seriously some game again my wife you throw my PC by the window! :P
That I can sympathize with. My wife is about to throw my computer out. In winter! When it's cold!

Seriously though, it's really not that hard. I haven't programmed in twenty years, and I picked this stuff up in two weeks. There are a lot of resources available. The xml guide in the stickies, for example, was a huge help.

And I'll help.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Fri, 6. Feb 15, 01:54

D.O.S. wrote:Hi w.evans

Will this mod also fix shipyards not reseting there construction drones ?

The shipyard drone bug is the only one i have to save edit to correct
Tried to do a little test to see if this fixes the shipyard issue as well. Test set-up:

Made sure that the shipyard engineer in the PMC Shipyard in Shady Vault is not repairing anything.
Checked to make sure that it had unavailable drones. (It had 72)
Turned on the logbook spew on Engineer Drone Fix with these conditions:

Code: Select all

<do_if value="this.owner == faction.plutarch and  $Defensible.isclass.station">
Loaded the save, and ordered a Sanahar built.

And got this:
Logbook wrote:<entry time="372052.875" text="Drone workaround active on PMC Capital Shipyard I
Raw Repair Rate: 50
Engineer Skil: 40
Repair Rate Factor: 72
Resultant Repair Rate: 9350"/>
That is:
PDA wrote:Drone workaround active on PMC Capital Shipyard I
Raw Repair Rate: 50
Engineer Skil: 40
Repair Rate Factor: 72
Resultant Repair Rate: 9350
"Repair Rate Factor: 72" being indicative of using 72 welder drones.

So I think that it does fix that problem, but can't be absolutely sure without knowing where the code running ship-building is.

Can someone please verify? I haven't kept figures on how long it normally takes, so can't compare if it's faster now.

_____
edit: found it, I think.

Code: Select all

              <do_if value="event.param2.{2}">
                <set_value name="$selectedMacro" exact="macro.{event.param2.{1}}" />
                <set_value name="$droneplan" exact="event.param2.{5}" />
                <set_value name="$buildcost" exact="event.param2.{6}" />
                <create_build_plan macro="$selectedMacro" buildplan="$Buildplan" buildplanlist="event.param2.{3}" upgradeplanlist="event.param2.{4}" />
                <construct_ship object="$actor.container" buildmodule="$BuildModule" macro="$selectedMacro" faction="faction.player" buildplan="$Buildplan" updatebuild="true"/>
                <do_if value="$BuildModule.buildanchor.exists">
                  <set_value name="$ship" exact="$BuildModule.buildanchor" />
                  <set_value name="$actor.$shiptrader_isbusy" exact="true" />
                  <signal_cue cue="ListenOnShipDestroyed" />
                  <add_npc_line line="[1012, 1013].random" />
                </do_if>
                <do_else>
                  <do_any>
                    <add_npc_line line="[1014, 1015].random" />
                  </do_any>
                </do_else>
              </do_if>
in md\NPC_Shiptrader.xml
Problem is these commands:

Code: Select all

                 <create_build_plan macro="$selectedMacro" buildplan="$Buildplan" buildplanlist="event.param2.{3}" upgradeplanlist="event.param2.{4}" />
                <construct_ship object="$actor.container" buildmodule="$BuildModule" macro="$selectedMacro" faction="faction.player" buildplan="$Buildplan" updatebuild="true"/>
are most likely hard-coded (they do not reference externalized scripts, and my guess is that they call commands built into the engine)
And there are no references to welder drones or masstraffic anywhere in that file.

_____
edit 2: 2nd test:

Modified the repair rate factor for PMC stations * 1000
Ordered a Sanahar, a Fedhelm, and a CV built (in that order).
Got this in my logbook:
logbook wrote:PMC Capital Shipyard I STATION REPAIR RATE:
Repairing: 98.2725
Raw Repair Rate: 50
Engineer Skil: 40
Repair Rate Factor: 2880072
Resultant Repair Rate: 144003600"/>
Build animation started immediately.

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Fri, 6. Feb 15, 14:45

Looking good!! :wink: 8)

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Fri, 6. Feb 15, 16:05

@Rubini, With regard to the shipyard problem, either very good or very bad, I'm afraid.

Either the engineer fix works on that too (it looks like the engineer fix, hence engineer.ai.xml, is being invoked when ships are being constructed, but I haven't found a way to verify that it's actually affecting ship construction or if it's just being invoked to do something trivial.)

Or the shipyard problem can't be fixed without some serious memory patching or something arcane like that because the actual commands used to construct the ships (<create_build_plan ... /> and <construct_ship ... />) aren't modifiable via xml patching.

MikeyL86
Posts: 1
Joined: Fri, 6. Feb 15, 19:21
x4

Post by MikeyL86 » Fri, 6. Feb 15, 19:34

Hi, I was just wondering if this will be compatable with the 100% engineer mod?
http://steamcommunity.com/sharedfiles/f ... t=engineer

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Fri, 6. Feb 15, 19:54

Yup. Both this and Station Engineers are compatible with Engineer 100.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Wed, 11. Feb 15, 16:33

Note on Compatibility: denison10 (angel618 on Steam) recently incorporated this code into his mod, Engineer 100%, with my permission. This effectively breaks compatibility between Engineer Drone Fix and Engineer 100%. Please do not install both of them at the same time.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Wed, 18. Feb 15, 09:06

18.Feb.2015 - v0.04 is up!

Slightly changed the code resulting in slightly fatter code but much improved compatibility, better than that in v0.03. (Thanks, Marvin Martian!)

Post Reply

Return to “X Rebirth - Scripts and Modding”