[MOD 0.18] RITEG

Topics and discussion about specific mods
User avatar
Omnifarious
Filter Inserter
Filter Inserter
Posts: 278
Joined: Wed Jul 26, 2017 3:24 pm
Contact:

Re: [MOD 0.16] RITEG

Post by Omnifarious »

This is really balanced. You'll get about the same energy from a single RITEG as you would from your fuel cells in a reactor with no neighbor bonus.

40MW * 200 seconds * 5 fuel cells = 40GJ

Integrating the power output curve over 32 half lives:

integrate 600000*e^(x*(-ln(2)/(12*60*60))) dx from x=0 to 16*12*60*60 means you get 37.39GJ in total out of your RITEG.

You did your math. :-)

The reactor should last for about 398684 or 398685 seconds (aka 12 * 60 * 60 * log(600) / log(2)) which yields about 37.332 GJ of energy during the reactor's actual lifetime, which is only about 9.2 half-lives.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.16] RITEG

Post by darkfrei »

It's more balanced as you think. The energy in the new RITEG is 5 x 8GJ exactly, also at the first moment will be exactly 600 kW output power.
The half life period will be calculated for this energy and this power so, that all maths will be always correct.

Exactly maths for new RITEG-1:
starting power: 10000*60 W
half life: 46209.812 seconds or 12,83 hours
starting energy: 40000000000 J or 40 GJ

Energy after 16's half period:
integrate 600000*e^(x*(-ln(2)/(46209.812))) dx from x=0 to 16*(46209.812) = 3.99994 * 10^10 J = 40 GJ
m3lk0rrr
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Nov 02, 2018 11:55 am
Contact:

Re: [MOD 0.16] RITEG

Post by m3lk0rrr »

autodeconstruct draft
recommended with recursive blueprints

locale.cfg

Code: Select all

...
[mod-setting-name]
__RITEG__autodeconstruct-is-enabled=Autodeconstruct
__RITEG__autodeconstruct-health-threshold=Threshold

[mod-setting-description]
__RITEG__autodeconstruct-is-enabled=Enable autodeconstruct the RITEG when it falls below the threshold percentage value
__RITEG__autodeconstruct-health-threshold=Threshold value in percentage for autodeconstruct. When the the RITEG health falls below the threshold it will be marked for autodeconstruct by bot. Valid values: [5,90]

diff unified patch RITEG-control.lua

Code: Select all

@@ -1,5 +1,6 @@
 -- local E = 40 -- GJ
 -- local P = 600 -- kW
+local mod_name = "__RITEG__"
 local ln_2 = 0.69314718
 local rtg_names_list = {'RITEG-1'}
 local RTG_prop =
@@ -12,11 +13,28 @@
   try_init ()
   update_recipes ()
   add_all_rtgs_to_table ()
+  update_settings ()
 end)

+-- update riteg settings
+function update_settings (event)
+  global.rtgs_settings["enabled"]   = settings.global[ mod_name .. "autodeconstruct-is-enabled" ].value
+  global.rtgs_settings["threshold"] = settings.global[ mod_name .. "autodeconstruct-health-threshold" ].value
+
+  global.rtgs_settings["max_healths"] = {}
+  for i, e in pairs (rtg_names_list) do
+    global.rtgs_settings["max_healths"][e] = game.entity_prototypes[e].max_health
+  end
+end
+
+-- call update_settings when on_runtime_mod_setting_changed
+script.on_event(defines.events.on_runtime_mod_setting_changed, update_settings)
+
+
 script.on_init(function(data)
   try_init ()
   update_recipes ()
+  update_settings ()
 end)

 function is_element_in_list (element, list)
@@ -80,6 +98,7 @@
   if not global.rtgs then global.rtgs = {} end
   if not global.tick_id then global.tick_id = 1 end
   if not global.total_rtgs then global.total_rtgs = 0 end
+  if not global.rtgs_settings then global.rtgs_settings = {} end
 end

 script.on_event(defines.events.on_built_entity, function(event)
@@ -145,6 +164,15 @@
     rtg.entity.health =  math.floor(power/(50/3))
   end
   -- end of new code
+
+  -- autodeconstuct
+  if global.rtgs_settings["enabled"] == true then
+    local threshold_health = ( global.rtgs_settings["threshold"] * global.rtgs_settings["max_healths"][rtg.entity.name]) / 100
+    if rtg.entity.health < threshold_health then
+      rtg.entity.order_deconstruction(rtg.entity.force)
+    end
+  end
+  -- end of autodeconsturt

   --printAll('RITEG [' .. global.tick_id .. '] has power ' .. rtg['power'] .. 'W and half_life = ' .. rtg['half_life'] .. 's')
   global.tick_id = global.tick_id + 1
settings.lua

Code: Select all

local mod_name = "__RITEG__"
data:extend({
	{
        type = "bool-setting",
        name = mod_name .. "autodeconstruct-is-enabled",
        setting_type = "runtime-global",
        default_value = true,
        order = "aa",
    },
    {
        type = "int-setting",
        name = mod_name .. "autodeconstruct-health-threshold",
        setting_type = "runtime-global",
        minimum_value = 5,
        maximum_value = 90,
        default_value = 5,
        order = "ab",
    }
})
recursive bp POC
Attachments
RITEG_0.1.6.ZIP
(265.13 KiB) Downloaded 128 times
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.16] RITEG

Post by darkfrei »

m3lk0rrr wrote: ↑Fri Nov 02, 2018 12:35 pm autodeconstruct draft
recommended with recursive blueprints
Thanks for your code, it was helpful.

Added new version with auto deconstruct and replacing of old RITEGs.
User avatar
Omnifarious
Filter Inserter
Filter Inserter
Posts: 278
Joined: Wed Jul 26, 2017 3:24 pm
Contact:

Re: [MOD 0.16] RITEG

Post by Omnifarious »

Any plans to update this for 0.17? :-)
Last edited by Omnifarious on Mon Mar 04, 2019 1:16 am, edited 2 times in total.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.16] RITEG

Post by darkfrei »

Omnifarious wrote: ↑Sat Mar 02, 2019 4:12 pm Any plans to update this for 0.17? :-)
Yes, probably today.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.17] RITEG

Post by darkfrei »

Updated to Factorio version 0.17.
User avatar
Omnifarious
Filter Inserter
Filter Inserter
Posts: 278
Joined: Wed Jul 26, 2017 3:24 pm
Contact:

Re: [MOD 0.17] RITEG

Post by Omnifarious »

darkfrei wrote: ↑Sun Mar 03, 2019 3:32 pm Updated to Factorio version 0.17.
Thank you! :-)
aka13
Filter Inserter
Filter Inserter
Posts: 823
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: [MOD 0.17] RITEG

Post by aka13 »

darkfrei wrote: ↑Sun Mar 03, 2019 3:32 pm Updated to Factorio version 0.17.
Hey! I was wondering, if I am being retarded, or if you mistyped something? In the recipe for the RITEG I get a strange error -
Image

I know that I do have the Simple Silicon mod, which alters the recipe of the t2 and t3 circuits. Do you mind helping me out finding the cause for this problem?
Pony/Furfag avatar? Opinion discarded.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.17] RITEG

Post by darkfrei »

aka13 wrote: ↑Fri Jun 07, 2019 6:59 am I know that I do have the Simple Silicon mod, which alters the recipe of the t2 and t3 circuits. Do you mind helping me out finding the cause for this problem?
Thanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
https://mods.factorio.com/mod/PlutoniumEnergy
Last edited by darkfrei on Fri Jun 07, 2019 5:24 pm, edited 1 time in total.
aka13
Filter Inserter
Filter Inserter
Posts: 823
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: [MOD 0.17] RITEG

Post by aka13 »

darkfrei wrote: ↑Fri Jun 07, 2019 7:03 am
aka13 wrote: ↑Fri Jun 07, 2019 6:59 am I know that I do have the Simple Silicon mod, which alters the recipe of the t2 and t3 circuits. Do you mind helping me out finding the cause for this problem?
Thanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
Your reply rate is higher than any corporate b2b support I have ever worked with :D . Thank you.
Pony/Furfag avatar? Opinion discarded.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.17] RITEG

Post by darkfrei »

aka13 wrote: ↑Fri Jun 07, 2019 8:23 am
darkfrei wrote: ↑Fri Jun 07, 2019 7:03 am
aka13 wrote: ↑Fri Jun 07, 2019 6:59 am I know that I do have the Simple Silicon mod, which alters the recipe of the t2 and t3 circuits. Do you mind helping me out finding the cause for this problem?
Thanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
Your reply rate is higher than any corporate b2b support I have ever worked with :D . Thank you.
Updated, it was earlier an alternative for advanced circuit
Multiple calculations per tick, not tested
Attachments
2019-06-07T21_12_05-Factorio 0.17.45.png
2019-06-07T21_12_05-Factorio 0.17.45.png (118.37 KiB) Viewed 4028 times
Last edited by darkfrei on Mon Jan 27, 2020 9:54 pm, edited 1 time in total.
aka13
Filter Inserter
Filter Inserter
Posts: 823
Joined: Sun Sep 29, 2013 1:18 pm
Contact:

Re: [MOD 0.17] RITEG

Post by aka13 »

darkfrei wrote: ↑Fri Jun 07, 2019 7:19 pm
aka13 wrote: ↑Fri Jun 07, 2019 8:23 am
darkfrei wrote: ↑Fri Jun 07, 2019 7:03 am
aka13 wrote: ↑Fri Jun 07, 2019 6:59 am I know that I do have the Simple Silicon mod, which alters the recipe of the t2 and t3 circuits. Do you mind helping me out finding the cause for this problem?
Thanks for report, I'll try to fix it.
https://mods.factorio.com/mod/SimpleSilicon
Your reply rate is higher than any corporate b2b support I have ever worked with :D . Thank you.
Updated, it was earlier an alternative for advanced circuit
Thank you very much! It works great. And of course, thank you for your mod. A pleasure to play.
Pony/Furfag avatar? Opinion discarded.
User avatar
mrudat
Fast Inserter
Fast Inserter
Posts: 248
Joined: Fri Feb 16, 2018 5:21 am
Contact:

Re: [MOD 0.18] RITEG

Post by mrudat »

https://mods.factorio.com/mod/RITEG/dis ... a405f0bf3a

Crash on changing map-wide settings, possibly due to RITEGs being cloned by warptorio2?
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.18] RITEG

Post by darkfrei »

mrudat wrote: ↑Tue Aug 25, 2020 4:44 pm https://mods.factorio.com/mod/RITEG/dis ... a405f0bf3a

Crash on changing map-wide settings, possibly due to RITEGs being cloned by warptorio2?
I don't know how to do that. I have problems with Lua Remote.
Post Reply

Return to β€œMods”