[MOD] Station Production Limiting v0.05 (6th Apr 2017)

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

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

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

[MOD] Station Production Limiting v0.05 (6th Apr 2017)

Post by jth » Tue, 5. Jan 16, 17:42

6 April 2017

I have just uploaded version 0.05 to the Nexus mod site and Steam

www.nexusmods.com/xrebirth/mods/466/

http://steamcommunity.com/sharedfiles/f ... =626271301

Station Production Limiting works with X Rebirth 3.61, 4.00 and 4.10 RC3

YouTube Videos v0.01

X Rebirth Station Production Limiting mod 101
https://youtu.be/k1YB-gXAkRQ


X Rebirth Station Production Limiting mod 201
https://youtu.be/1hG6Uhb-I9A


X Rebirth Station Production Limiting mod 301
https://youtu.be/woTcIDXW_P4

Changes from v0.04
Compensate for format of game version string changing in 4.10 RC3 and add extra paranoia when checking version to prevent crashing the GUI

Changes from v0.03
Production Limiting menu was always using the default production method even with OL stations which caused food to be displayed as a primary resource instead of Bofu. Although it displayed food while setting the Limiting factor it actually correctly returned Bofu so this was actually cosmetic. Added a work around that should cope with omicron, devries and xenon production methods

Changes from v0.02

"increased paranoia" by doing more input and API return value checking in lua scripts. I hope this will help to cope with weird and wonderful game scenarios, duff stations, API calls that unexpectedly fail and other oddities


Changes from v0.01

Add the minimum primary wares that are needed to start a production batch and a station Storage column to Production Limiting menu.
Unfortunately that changes what the Production Limiting menu looks like and breaks all of the videos a bit :(
Improve onUpdate to only update the screen if something has changed
Add station storage to onUpdate
Compensated for changes to API calls in 4.00

Objective

To provide a way to limit a stations production of wares

How to Use

Select the Station whose production module you wish to limit and click on Details
Expand the Production modules section
Select the Production module that you want to limit and click on Details

The Production Limiting section lists all of the wares that this module can produce
Click on the configuration icon (spanner) to the left of the ware that you want to limit
Now use the slider in the Production Limiting menu to set the production limiting or brake factor. 0% does nothing and 100% will stop all production for this module
Click on OK to accept the limit or Back to abandon any changes
This ware will now be limited

To change your mind return to the Production Limiting menu at any time
Setting the limit to 0% and clicking on OK will remove a production limit

If you want to use the Configuration menu then click on the top left icon (spanner) on the Production Limiting menu
If you set the Global Debug to 1 or 2 and look in the debug log then you will see some additional information that shows what is happening under the bonnet.
You will need a log file tailing program such as SnakeTail (http://snakenest.com/snaketail) to watch the end of the debug.log

The Station Production Limiting mod

Allows for limiting of individual production lines on player stations
Allows different limits to be placed on each production module on each station and across different player stations
Supports the Turret, URV and Missile Forges which produce multiple products by limiting one or more of the potential products
If a product is 100% limited then the production cycle still runs but the production module, on average, produces nothing and consumes nothing
Reduces consumption of Primary and Secondary wares to go with the reduction in Products
Multi-lingual with support for Russian, French, Italian, Spanish, English and German

Setting Limits

A production limit can be set at any time and will return un-needed resources at the start of the cycle (if production is running) but the product totals (stock adjustment) will only update at the end of a working production cycle
The Production Limiting menu works in the same way as the Encyclopedia menu and does not show the effect of Product Efficiency (Specialists etc) but it will take that into account when it adjusts the production quantities
The Production Limiting menu only shows Primary Resources due to space limitations but it will limit the use of secondary resources when
it adjusts the production quantities
As resources cannot be produced or consumed in fractions of units this mod attempts to limits the factor to values that consume and create
complete units of wares

Configuration menu

Lets you dynamically set the Debug level.
The higher of the Global or Station setting takes effect for that station
If you set the Global Debug to 1 or 2 and look in the debug log then you will see some additional information that shows what is happening under the bonnet.
You will need a log file tailing program such as SnakeTail (http://snakenest.com/snaketail) to watch the end of the debug.log
Lets you log the configuration to the Logbook
Allows you to remove most of the data that this mod uses

How it works

This is a work around to the station managers production software

It relies on the station manager moving some wares around for it and adjusting the total production at the end of each batch as the production module software doesn't realise that some of its resources have been put back into stock

The full set of wares is still needed to start off a modified production cycle.
Within about 10 seconds of production starting the manager restocks a proportion of the wares which prevents the production module from producing the full amount of product and reduces the wares that it consumes
At the end of the production cycle the manager has to adjust the stock levels of product as the production module thinks that it has produced more than it actually has.
The net result of the station managers work is to reduce the total amount of a specific ware that is produced and to reduce the wares that it consumes.

Missile, URV and Turret Forges

These produce more than one product by cycling betweeen the available products.
The products can be individually limited and the limits can be set at any time.
The limits for a specific product won't take effect until that product gets to its production slot.

Known issues

The full set of wares is still needed to start off a production cycle
The Production Limiting screen works in the same way as the Encyclopedia screen and does not show the effect of Product Efficiency (Specialists etc) but it will take that into account when it adjusts the production quantities
The Production Limiting screen only shows Primary Resources due to space limitations but it will limit the use of secondary resources when it adjusts the production quantities
The Production Limiting screen slider value display has some rounding issues and only shows to the nearest integer
The debug information for the Missile, URV and Turret Forges does not correctly identify if a specific product is being produced - it reports them all as in the same state - cosmetic
Clearing the limits still leaves an empty list and a single blank value on each manager and the players BlackBoards. There is no lua Delete BlackBoard entry that I know of at the moment

ToDo

Module level debuging
Fully clean up player and Manager Blackboards
Alter the production rates on the main production menu to show the effects of the production limit
Production Limit menu maybe put up a warning at the top of the screen if you are missing the resources to start a production cycle

jth

-- moved this down to put release info above

I am thinking about digging into the feasability of applying a throttle factor to each production module of a station. I have been through the request thread and I think its some of item 5 from a post by Hardcard on Wed 15th June 2014 (its about half way down page 23)

I think that production can be currently stopped by an existing mod that fiddles the hull percentage which is a neat idea.

but would like to add a 0 - 100 % capability via a slider that would reduce production to say 50% using 50% of the resources over the same length of time

It would be a combined UI mod for the slider and somewhere to put the throttle percentage plus some interaction with the production script to apply it. Could probably store the config in the station manager blackboard and wipe it if they get re-assigned.

If I can get that working then I might look at turning on and off selling of secondary resources and controlling the point at which the station starts to sell them.

has anyone else gone down this path ?

Any pointers on where the station ware production code is ?

Thoughts anyone ?

jth
Last edited by jth on Thu, 6. Apr 17, 18:56, edited 19 times in total.

User avatar
Marvin Martian
Posts: 2962
Joined: Sun, 8. Apr 12, 09:40
x4

Post by Marvin Martian » Tue, 5. Jan 16, 17:50

you can stop the production by hack the module also
i just not figured out how to restart it earlier then the hack would ending :roll:

but you could in case you know how long the production run is, stop the module this time, so you have 50% production and use of ressources :wink:

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 7516
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Tue, 5. Jan 16, 18:22

Nice idea!

In terms of regular modules that don't cycle their ware production, the idea could help with:

1. Ship construction components are often (always?) not on cycling modules.

2. Missile Forges seem pretty pointless at the moment, while ships re-arm for free, so turning them off all together wouldn't be terrible. Especially since they are the default initial module in the two otherwise-desirable weapon-production stations that are capable of building their own intermediates.


It may be out-of-scope or impossible but some initial thoughts in case it could be applied to specific wares made my modules that cycle:

1. Even if ship component and surface element production rates matched consumption rates in the past, additions of new ships will have ensured that there's imbalance and over-production of some things today.

2. Could address Missile Forges making things that are not even used by shipyards (Sunstalkers & Novadrones).

3. Could address OL MIL High-Tech stations making missile turrets that are not used by that faction.

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Thu, 7. Jan 16, 23:00

I have been having a poke about to try and find the various bits with mixed success.

I have found the lua code for the details of a production module under menu_production.lua and it looks to be fairly easily changed :)

but can't find any trace of the code that controls production so that I can slip a multiplier factor into it.

There are a few traces of inputs to the process in wares.xml

Code: Select all

    <production time="120" amount="400" method="omicron" name="{20206,301}">
      <primary>
        <ware ware="energycells" amount="80" />
        <ware ware="ice" amount="320" />
      </primary>
      <effects>
        <effect type="specialist" product="0.2" />
        <effect type="manager" product="0.06" />
        <effect type="engineer" product="0.06" />
        <effect type="defencecontrol" product="0.06" />
      </effects>
    </production>
The effects seem to be things that can affect production. This shows how having a specialist helps and by how much.

If the ware production system isn't in a script but is some sort of engine then it may need to be finessed by its inputs

Assuming that it will allow negative numbers for product (I have managed to un-build a ship before with -1.0 so its not impossible) and is worth a try ...

So I could try to create some additional NPC types with a -0.2 or more effect and drop them on the station

The other thought is maybe to add a physical object to the production line like the Sensorium but with a negative effect number ... thats a far neater solution if it could be made to work. Like a series of interchangeable leaky airlocks with 5% (-0.05) 10% (-0.10) etc etc reduction. The real beauty is that it might even slot itself into the GUI saving me half the work.

jth

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Fri, 8. Jan 16, 17:41

I have done some experiments with an Argnu meat production line and found out a few things

The specialist didn't work very well as there seems to be a "keep it positive" buried in the ES code and the specialist vanishes from the list of factors if the number is negative. Thats not a major issue as I felt that the hardware was a better approach anyway.

The Sensorium was a lot more useful as that will take negative numbers for efficiency and it affects the production as I hoped and it displays correctly :) I switched to using the Storage bridge though as its a simpler object with no shields or guns attached

If I change the storage bridge macro definition efficiency from 0.04 to -0.80 then production reduces by 84% when the next batch starts as I had hoped and the Storage Bridge shows up as -80% which is exactly what I was looking for

It does affect every single Storage Bridge in the galaxy at the moment, so I am working on defining some less efficient Storage Bridge macros and assigning one of them to to the single Meat line that I am playing with. Finding the right Storage Bridge and changing its macro in the savegame is proving to be rather more difficult that I thought it would be :(

If I can do that in a script then I may be in business

So far game 1 jth 0 :)

jth

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13923
Joined: Sun, 20. Nov 05, 23:45
x4

Post by UniTrader » Sun, 10. Jan 16, 14:35

nice idea with the Efficiency Modules - could work for complete throttling of the whole Production by using Hull Damage for an untouchable Station Part by using a macro like this:

Code: Select all

<macros>
  <macro name="production_slowdown_part_macro" class="destructible">
    <component ref="dummy_component" />
    <properties>
      <identification name="'Manual Production Slowdown'" description="'Manual Production Slowdown'"/>
      <hull max="1001" hittable="0" />
      <effects>
      </effects>
      <efficiency bonus="-1.0">
        <threshold threshold="1.0" value="1.0" />
        <threshold threshold="0.001" value="0.0" />
      </efficiency>
    </properties>
  <connections/>
 </macro>
</macros>
and setting the Hull Value accordingly (with the above definition 0.1% steps are possible - not sure if it would make problems but i want to avoid complete destruction of this "Station Part" therefore there is 1 additional hull point - this also makes the Scripting a bit easier since you dont have to account for a destructed component)

you have to add this Module to all Stations for each Sequence and Stage though (and patching all Stations in the Universe, although this should be simple by using a class filter)

Sadly this also has the effect of Slowing down to a halt until something is done, but alternate Solution would be to swap the value of both thresholds - so if the Component is fully functional there is no Slowdown and the more Destroyed it is the more efficient it works and slows down Production..

this could also be very easy added to all Station Macros by using the same File with clever Sel Paths for all Stations (it would filter automatically from the existing file if the sequence/stage exists and if not it isnt added)
like this:

Code: Select all

<add sel="//connections[connection/build[@sequence='A' and @stage='1']]" optional="true">
  <connection ref="ConnectionFor_production_slowdown_part_macro_A1">
    <build mode="optional" sequence="A" stage="1" />
    <macro ref="production_slowdown_part_macro" connection="space" />
  </connection>
</add>
and the same for all possible Sequence/Stage Combinations
the Component File needs the full set added though since its not possible to retrieve this Information there (and multiple Station Macros could use the same Component but a diffrent Build Tree), but this is a non-issue since these wont disturb.


PS didnt test anyhing of this InGame - but i think it should work...
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Sun, 10. Jan 16, 17:54

Truely brilliant timing :)

I was just beating my head against a brick wall with my approach which was to add an upgradable part to the production module itself. I was then going to have a 5% 10% etc throttle upgrade
UniTrader wrote:nice idea with the Efficiency Modules - could work for complete throttling of the whole Production by using Hull Damage for an untouchable Station Part by using a macro like this:

Code: Select all

<macros>
  <macro name="production_slowdown_part_macro" class="destructible">
    <component ref="dummy_component" />
    <properties>
      <identification name="'Manual Production Slowdown'" description="'Manual Production Slowdown'"/>
      <hull max="1001" hittable="0" />
      <effects>
      </effects>
      <efficiency bonus="-1.0">
        <threshold threshold="1.0" value="1.0" />
        <threshold threshold="0.001" value="0.0" />
      </efficiency>
    </properties>
  <connections/>
 </macro>
</macros>
and setting the Hull Value accordingly (with the above definition 0.1% steps are possible - not sure if it would make problems but i want to avoid complete destruction of this "Station Part" therefore there is 1 additional hull point - this also makes the Scripting a bit easier since you dont have to account for a destructed component)
Your idea would give much better granularity and would avoid it being an upgrade which is simpler. Using the hull damage is a much easier and portable (md and lua) interface to it too :)
UniTrader wrote:you have to add this Module to all Stations for each Sequence and Stage though (and patching all Stations in the Universe, although this should be simple by using a class filter)
Can I add the module (patch) a station only when someone wants to throttle one of their production lines ?
UniTrader wrote:Sadly this also has the effect of Slowing down to a halt until something is done, but alternate Solution would be to swap the value of both thresholds - so if the Component is fully functional there is no Slowdown and the more Destroyed it is the more efficient it works and slows down Production..
UniTrader wrote:this could also be very easy added to all Station Macros by using the same File with clever Sel Paths for all Stations (it would filter automatically from the existing file if the sequence/stage exists and if not it isnt added)
like this:

Code: Select all

<add sel="//connections[connection/build[@sequence='A' and @stage='1']]" optional="true">
  <connection ref="ConnectionFor_production_slowdown_part_macro_A1">
    <build mode="optional" sequence="A" stage="1" />
    <macro ref="production_slowdown_part_macro" connection="space" />
  </connection>
</add>
and the same for all possible Sequence/Stage Combinations
I think that you have just answered my question about how it knows that the slowdown module belongs to a particular production line even though it isn't physically attached to it. Thanks.

OK I think that I am with you on that one. I had thought of identical files with the names of each of the station macros but if you can do it with one file then that's even better.
UniTrader wrote:the Component File needs the full set added though since its not possible to retrieve this Information there (and multiple Station Macros could use the same Component but a diffrent Build Tree), but this is a non-issue since these wont disturb.


PS didnt test anyhing of this InGame - but i think it should work...
Can you please provide some more info on what to do with the component file or point me to some example for extending things with additional modules. I haven't attempted to change an object before, I just blow them up :)

I think that this is what I am currently banging my head against

jth

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13923
Joined: Sun, 20. Nov 05, 23:45
x4

Post by UniTrader » Sun, 10. Jan 16, 18:52

Your idea would give much better granularity and would avoid it being an upgrade which is simpler. Using the hull damage is a much easier and portable (md and lua) interface to it too :)
If it works - there is no case where the Efficiency Modules are influenced by Hull Damage yet, but the Efficiency Node is used in this manner for Engines and Weapons, so i am pretty sure it should work as expected in this case too - but not entirely sure.. - i suggest making a Test Case for a single Station first before doing the major work ;)
Can I add the module (patch) a station only when someone wants to throttle one of their production lines ?
you can Patch the Stations on demand by looking for your Efficiency Modules, if none are found Patch the Single Object and look again - if none are found now abort since the Object is invalid, continue as usual otherwise.
This leaves existing Objects unaltered, but the Change will be present on Objects created after Mod Installation (they should remove themselves when deactivating the Mod though)

Dynamic Upgrades are more tricky, try to avoid them at all costs - they are tricky and if you use them you break the whole 0-100% Upgrade Functionality for this Object Type, it will only use Multimacro Upgrades for everything then. Also not sure how Station Building would be influenced by that since i only have experience with Ships using them.
OK I think that I am with you on that one. I had thought of identical files with the names of each of the station macros but if you can do it with one file then that's even better.
One File copied over and over - was in thoughts more on Linuy where i would simply symlink them all to a "master" file, but this is not as trivial in Windows... in facte i ment multiple files with the same contents ;)
Can you please provide some more info on what to do with the component file or point me to some example for extending things with additional modules. I haven't attempted to change an object before, I just blow them up :)
you basically need to add the connection referenced in the macro file there, here for example the component counter-part for the self-filtering example above:

Code: Select all

<add sel="//connections">
  <connection name="ConnectionFor_production_slowdown_part_macro_A1" group="stationGroup" tags="destructible">
    <offset/>
  </connection>
</add>
you can copy/re-use the same file for all component files here, too
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13923
Joined: Sun, 20. Nov 05, 23:45
x4

Post by UniTrader » Sun, 10. Jan 16, 19:53

sorry for double-Post but have to add something here:

the Production Multiplier seems to be additive based on the definition not multiplicative as i assumed ( 0.08 for 8% bonus instead of 1.08 ) - this has to be accounted for when setting this up and writing the Scripts (by using a buffer in the eficciency bonus, like -1.5 insted of the -1.0 above for potential boni and also taking these into account when slowing down production)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Mon, 11. Jan 16, 13:59

UniTrader wrote:sorry for double-Post but have to add something here:

the Production Multiplier seems to be additive based on the definition not multiplicative as i assumed ( 0.08 for 8% bonus instead of 1.08 ) - this has to be accounted for when setting this up and writing the Scripts (by using a buffer in the eficciency bonus, like -1.5 insted of the -1.0 above for potential boni and also taking these into account when slowing down production)
Double post is fine, I think of lots of things immediately after posting

I was aware that it is additive, and has some interesting sums :) the specialist 0.20 gets turned into 15 % in the GUI so it will need a buffer (may look at the sums if I get as far as modifying the gui). I am just hoping that turning the whole lot negative doesn't do anything nasty but there is only one way to find out ...

My emphasis is more on slowing than stopping although stopping would be nice. But if the station hull gets damaged after the throttle is set then the sums are going to go walkies

At the moment I am fighting the code to get the slowdown_part added to my station

I think that I may have typo'd something so decided to make a strategic retreat yesterday and take a fresh look this morning

I may be back :)

jth

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Tue, 12. Jan 16, 18:43

I am getting massively frustrated with this :( nothing that I do has any effect

So I went back to basics

I have to change the standard stations, a new station definition will not allow me to affect station production rates on existing stations.

New objective Change the build definition for the Floating Meadows to remove the Zoltech Reactor from the base level on a new build Floating Meadows

extensions/station_production/assets/structures/buildtrees/struct_bt_alb_farm_complex.xml

Code: Select all

<?xml version="1.0"?>
<diff>
	<remove sel="/components/component[@name='struct_bt_alb_farm_complex']/connections/connection[@name='ConnectionFor_struct_econ_ref_ar_pmc_basis_macro']" />
</diff>
extensions/station_production/assets/structures/buildtrees/Macros/struct_bt_alb_farm_complex_macro.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!-- created by eBaracuda -->
<diff>
	<remove sel="/macros/macro[@name='struct_bt_alb_farm_complex_macro']/connections/connection[@ref='ConnectionFor_struct_econ_ref_ar_pmc_basis_macro']" />
</diff>
No errors in debug.log

Its still in the construction plan and it still builds with a Zoltecth Reactor :(

What have I missed ?

New objective 2

Add a second Zoltech Reactor to the base build

jth

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Tue, 12. Jan 16, 19:15

I can't spell build_trees it has an underscore in it :(

jth

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Fri, 15. Jan 16, 14:42

Still not right so I thought that I should explain where I am and let you see what the files say

I just don't know what some of the parameters that I have borrowed to get this far actually do :(

I decided to experiment on a FoodStuffs Supply

Current observed behaviour on game load

I get the production Slowdown module in all production lines but they have no effect on production. They are there from gMainNav_menumap BUT they show no efficiency numbers (probably not displayed by the lua script but haven't checked)

I then comm the Defense officer which has the side effect of patching the station via a bit of md script

Code: Select all

      <conditions>
        <check_any>
          <event_conversation_started conversation="default" />
          <event_conversation_returned_to_section section="default" />
        </check_any>
        <check_value value="event.object.container.class == class.station"/>
        <check_value value="event.object.iscontrolentity" />
      </conditions>
      <actions>
        <set_value name="$SR_Station" exact="event.object.container"/>
        <debug_text text="$SR_Station.name + ' - ' + $SR_Station + ' - ' + $SR_Station.macro"/>
        <debug_text text="'Patching ' + $SR_Station.name"/>
        <patch_macro object="$SR_Station" />
All the Slowdown modules vanish except the one in the very first Foodstuff Fac which now affects production. If I browse the station from gMainNav_menumap then all the prduction modules except the Foodstuff Fac are gone. Within the Foodstuff Fac there is a single Slowdown Module. If I look via Details there are still seven production modules.

Changes from your suggestions
I ended up actually specifying a name for the component as it couldn't find dummy_component
I have temporarily removed the variable effect from production_slowdown_part_macro
The last two files come from a perl script that analyses struct_bt_alb_food_production_complex_macro.xml so the connection names are subtly different. There is therefore no need to conditionally patch as it knows what the production modules are and in what stage they are.

I think that I would actually like the Slowdown module to be visible at the gMainNav_menumap level if possible.

extensions\station_production\assets\structures\build_trees\Macros\production_slowdown_part_macro.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<macros>
  <macro name="production_slowdown_part_macro" class="destructible">
    <component ref="production_slowdown_part" />
    <properties>
      <identification name="Production Slowdown" description="Means to reduce efficiency to slow down production"/>
      <hull max="1001" />
      <efficiency bonus="-0.1">
      </efficiency>
    </properties>
  <connections/>
 </macro>
</macros>
extensions\station_production\assets\structures\build_trees\production_slowdown_part.xml

Code: Select all

<?xml version="1.0"?>
<components>
	<component name="production_slowdown_part" class="destructible">
		<layers>
			<layer>
				<waypoints/>
				<lights/>
			</layer>
		</layers>
		<connections>
			<connection name="container" tags="contents" value="0" optional="0"/>
			<connection name="position" tags="position" value="1" optional="1"/>
			<connection name="space" tags="destructible">
				<offset/>
			</connection>
		</connections>
	</component>
</components>
extensions\station_production\index\macros.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
  <add sel="/index">
    <entry name="production_slowdown_part_macro" value="\Extensions\station_production\assets\structures\build_trees\Macros\production_slowdown_part_macro" />
  </add>
</diff>
extensions\station_production\index\components.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
  <add sel="/index">	
	<entry name="production_slowdown_part" value="\Extensions\station_production\assets\structures\build_trees\production_slowdown_part"/>
  </add>
</diff>
extensions\station_production\assets\structures\build_trees\Macros\struct_bt_alb_food_production_complex_macro.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="//connections">
		<connection ref="ConnectionFor_production_slowdown_part_macro1">
			<macro ref="production_slowdown_part_macro" connection="space" />
		</connection>
		<connection ref="ConnectionFor_production_slowdown_part_macro_A1">
			<build mode="optional" sequence="A" stage="1" />
			<macro ref="production_slowdown_part_macro" connection="space" />
		</connection>
		<connection ref="ConnectionFor_production_slowdown_part_macro1_B1">
			<build mode="optional" sequence="B" stage="1" />
			<macro ref="production_slowdown_part_macro" connection="space" />
		</connection>
		<connection ref="ConnectionFor_production_slowdown_part_macro_B2">
			<build mode="optional" sequence="B" stage="2" />
			<macro ref="production_slowdown_part_macro" connection="space" />
		</connection>
		<connection ref="ConnectionFor_production_slowdown_part_macro_C1">
			<build mode="optional" sequence="C" stage="1" />
			<macro ref="production_slowdown_part_macro" connection="space" />
		</connection>
		<connection ref="ConnectionFor_production_slowdown_part_macro_D1">
			<build mode="optional" sequence="D" stage="1" />
			<macro ref="production_slowdown_part_macro" connection="space" />
		</connection>
		<connection ref="ConnectionFor_production_slowdown_part_macro_E1">
			<build mode="optional" sequence="E" stage="1" />
			<macro ref="production_slowdown_part_macro" connection="space" />
		</connection>
	</add>
</diff>
extensions\station_production\assets\structures\build_trees\struct_bt_alb_food_production_complex.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="//connections">
		<connection name="ConnectionFor_production_slowdown_part_macro1" group="stationGroup" tags="destructible">
			<offset/>
		</connection>
		<connection name="ConnectionFor_production_slowdown_part_macro_A1" group="stationGroup" tags="destructible">
			<offset/>
		</connection>
		<connection name="ConnectionFor_production_slowdown_part_macro1_B1" group="stationGroup" tags="destructible">
			<offset/>
		</connection>
		<connection name="ConnectionFor_production_slowdown_part_macro_B2" group="stationGroup" tags="destructible">
			<offset/>
		</connection>
		<connection name="ConnectionFor_production_slowdown_part_macro_C1" group="stationGroup" tags="destructible">
			<offset/>
		</connection>
		<connection name="ConnectionFor_production_slowdown_part_macro_D1" group="stationGroup" tags="destructible">
			<offset/>
		</connection>
		<connection name="ConnectionFor_production_slowdown_part_macro_E1" group="stationGroup" tags="destructible">
			<offset/>
		</connection>
	</add>
</diff>
A rather large post :)

Any thoughts on what else I have missed ?

jth
EDIT Dropbox link to extension available upon request

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Fri, 15. Jan 16, 18:01

I have added an entry to wares.xml so it knows what materials to use for the Production Slowdown module. I pinched the entries from the Sensorium

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
  <add sel="/wares">
  <ware id="stp_ref_pmc_slowdown" name="stp_ref_pmc_slowdown" transport="container" size="part" volume="1" tags="part">
    <price min="1" average="1" max="1" />
    <production time="152" amount="1" method="default" name="{20206,501}">
      <primary>
        <ware ware="energycells" amount="109" />
        <ware ware="fusionreactor" amount="7" />
        <ware ware="reinforcedmetalplating" amount="34" />
      </primary>
    </production>
    <component ref="production_slowdown_part_macro" amount="1" />
  </ware>
  </add>
</diff>
At this point if I build a new Floating Meadows then I am offered Production Slowdown modules in all the correct build stages by the Architect. I haven't managed this before.

The encyclopeadia button for the Production Slowdown module works correctly after created a t\0001.xml file.

One Production Slowdown module is correctly built for stage [a,0]

One Production Slowdown module is correctly built for stage [a,1]

They both produce at the correct throttled rate too

Will try a Foodstuffs Fac

EDIT 17:05 GMT

Foodstuffs Fac

I am offered Production Slowdown modules in all the correct build stages by the Architect

Builds fine with a single Production Slowdown module for each of a FoodStuff, Valley Forge and Argnu Beef production line

They all produce at the correct throttled rate (10%) too

Its slowly getting closer :)

Wonder whats upsetting the patching ...

Regards

jth

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31
x3

Post by jth » Tue, 19. Jan 16, 18:51

After some further experimenting I have come to a few conclusions

The Efficiency code works very well and does exactly what it says on the tin. It changes Production efficiency which means the amount of wares that come out for a given amount of wares that go in. I had thought that it also limited the amount of wares that go in but observation of a smaller Foodstuffs Fac show that it doesn't. That makes it a very in-efficient way of limiting production as you are essentially throwing away the resources that it doesn't need. Not what I was looking for.

I can't seem to get a reduction in hull for the module to turn into a reduction or increase in efficiency either. So the only way to vary the efficiency would be to upgrade modules and I can't get that to work reliably either.

A production throttle factor which affects input and output wares which is the ideal answer would require ES to add the functionality and provide API support

So in the medium term its going to have to be done another way ....

I have a few ideas for physical and virtual production throttles that will have the effect of throttling individual production lines without throwing away wares and will be trying them out with some code.

The first idea is a combined md and lua solution so will take a while to code up and see if it will work and if it has any nasty side effects too ...

I do have a final fallback which is to allow the Station Recycle to recycle individual production lines. If they aren't there then thats a pretty effective production throttle and it doesn't waste wares :)

Regards

jth

Post Reply

Return to “X Rebirth - Scripts and Modding”