[MOD 1.1] Xander Mod v3.6.1

Topics and discussion about specific mods
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

Version 3.5.0 Published

Post by Repofme1 »

Hi all -

Just a note to say that a new version is finally out, with my (sparse) work over the past several months. Here's a quick summary:

Advanced refining -
  • Copper
  • Nickel
  • Chromium
  • Platinum
  • Gold
  • Silver
  • Semiconductor silicon
  • Some petroleum content
Materials & Parts -
  • Stainless steel
  • Epoxy resin
  • All circuits tentatively complete
Machines & Equipment -
  • Small-lamp additional recipe
  • Solar panels
  • Electrical substation
  • Flamethrowers
Various other smaller things I can't remember

I have seen most of your recent comments & bug reports, and don't worry, I haven't forgotten - it simply takes me a long time to get to everything. As I mentioned recently, many of my other interests have been competing for hobby time lately.
jyf15
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Mar 02, 2020 4:38 am
Contact:

Re: [MOD 1.0] Xander Mod v3.5.0

Post by jyf15 »

Hi I'm new to this great mod. But I find that 4 coal makes 9 coke, while a coke has the same fuel value as a coal. Does that somehow break the law of conservation of energy? That is, with each coal processed thus, 20 MJ of energy is produced out of nowhere.
(Maybe there's another understanding: maybe we can say that coal actually contains more energy than can be utilized, and burning coal utilizes its energy very badly (say efficiency 20%), while coke contains the same amount of energy but converts a higher percentage of energy (say 45%)? Then, is this the case in the real world? The ratio set in this mod should be closer to real world scenario instead of inventing an improbable ratio.)
khadgarion
Inserter
Inserter
Posts: 43
Joined: Sun Dec 25, 2016 3:34 am
Contact:

Re: [MOD 1.0] Xander Mod v3.5.0

Post by khadgarion »

Hmm. There's a whole bunch of stuff that now requires the blue assembler (like medium power poles) instead of the grey assembler. That means automation of some fairly basic stuff requires tungsten production. I updated and my "mall" broke, lol.

EDIT: The assembler machines (grey ones) should have 4 ingredient capability, in my opinion. So many of the low tier entities require 4 ingredients that the standard assembly machine is of limited utility.
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

Version 3.5.1 Published

Post by Repofme1 »

Hi all -

New update just out! I feel like I got a pretty good amount of work into this one, summarized as follows:

Bugfixes:
  • Fixed piercing ammo recipes and rewrought military-4 into XM
  • Fixed broken electrolyzer fluid boxes
New content:
  • Expanded advanced refining & materials: top tier tin and lead, nylon plastic
  • Added induction 3 tech, as well as top-tier copper cable, coil, and motor
  • Added electric mining drill 2
  • Added electric plasma furnace
  • Added concentrating solar panel
  • Rewrought flying robots
  • Rewrought utility science pack
  • Rewrought low-density structure
As always, thanks for the comments, your interest makes me enjoy working on the mod all that much more. :)
Shadow_Man
Fast Inserter
Fast Inserter
Posts: 126
Joined: Fri Mar 02, 2018 2:55 pm
Contact:

Re: [MOD 1.0] Xander Mod v3.5.1

Post by Shadow_Man »

Mod is great, thank you. 8-)

But I have some questions (and not only me):
1. There is no wood production. Do I have to harvest wood by hand all the time?
2. Many assembling recipes of Tier1 machines require blue assembler, which is already on a different Tier. Maybe allow a standard (gray) assembler to produce Tier 1 machines?
3. Are there any plans to update the graphics? For example, conveyor icons in the style of the main game, 3D models of factories from the mod?

P.S. Bug in version 3.5.1: after changing the Plastic bar recipe, the Polyethylene granule recipe is not available in reactors.
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

Quick Update to 3.5.2 & More

Post by Repofme1 »

Hi all -

Lots of various stuff here, hope to address several things - I hear you, even when I don't individually respond.
---

First, I just got out a quick bugfix update to handle the problem I accidentally created with the new plastic bars. When I changed the name for the polyethylene pellets recipe, I forgot to include it in the migration file, so existing worlds with plastics researched lost that recipe because the game thought it was never unlocked. Obviously this breaks bases pretty bad, so I wanted to fix it as soon as possible. Again, thanks as deserved for pointing it out.

I also fit in a couple other things, here's the complete list. All pretty small stuff:
  • Partial fix for bug: gun turret damage upgrades didn't apply to high-power rifled turret
  • Fixed (hopefully) bug with polyethylene pellets production - I think recipes will still need to be re-selected, my apologies :(
  • Increased assembler 1 ingredient count to 4, by popular request
  • Added high-tension big electric pole (no new sprite yet - sorry!)
  • Added some iron gears to starting items
---
Speaking of bugs, someone also pointed out that the projectile damage technologies don't properly apply the damage bonus to the high-power rifled turret. I looked in the technology prototype, and it does in fact specify that the gun turret entity gets a damage bonus, so it was fairly simple for me to copy this for my improved turret. However, I don't know the function or variable to set in a migration file so that this bonus is applied to existing worlds with projectile damage techs already researched, and I'm not familiar enough with the API to really figure it out. If anyone knows how to do this, I would be grateful for the help.

---
I have also heard a lot of requests to increase the ingredient count on the assembler 1 from 3 to 4, to reduce the amount of hand crafting early on. Initially, I had made it only 3, because I always thought it would be strange if a low-tier assembling machine could reproduce itself - which is a huge challenge in real machine design. However, it seems that everyone finds this a large cause of tedium, so for the sake of enjoying the game I think 4 ingredients is an okay solution. Factorio isn't really that hard-realistic anyway - and if anyone (like me, haha) wants to keep the sense of challenge, it's simple enough to just only automate what you want to.

---
Regarding wood production: The facts are that wood is a very useful material for early industry, but also very annoying to gather in a mod about automation. Wood also has no properly realistic means of production, since it grows so slowly, so it has been troublesome since nearly the beginning of the mod. I like the idea of a semi-automatic machine, which just cuts existing trees nearby, and a while ago I even found another mod (for reference) that did just that - I think it was called Wood Harvester or something similar. However, it's more involved that just imitating the base prototypes like I usually do (again, no great master of the game API here), so I have gotten distracted with more advanced content. Presently, I am open to suggestions: Try scripting a woodcutter? Add some awkward wood production machine? Other ideas? I would like wood to still be difficult enough that there is reason to not simply keep using it through the whole game, which is sort of why I replaced all of its uses by early- or mid-tech. Unfortunately, this issue looks like it won't be easy to fully resolve.
kingarthur
Smart Inserter
Smart Inserter
Posts: 1463
Joined: Sun Jun 15, 2014 11:39 am
Contact:

Re: Quick Update to 3.5.2 & More

Post by kingarthur »

Repofme1 wrote: Sun Nov 01, 2020 3:57 am
---
Speaking of bugs, someone also pointed out that the projectile damage technologies don't properly apply the damage bonus to the high-power rifled turret. I looked in the technology prototype, and it does in fact specify that the gun turret entity gets a damage bonus, so it was fairly simple for me to copy this for my improved turret. However, I don't know the function or variable to set in a migration file so that this bonus is applied to existing worlds with projectile damage techs already researched, and I'm not familiar enough with the API to really figure it out. If anyone knows how to do this, I would be grateful for the help.
a bit of a brute force way is to add this code to a lua figration file. itll force the game to reload and reset all unlocked effects to the state they should be based on research completed. it can also be used as an in game command

Code: Select all

game.reload_script()

for _,player in pairs(game.players) do
   player.force.reset_recipes()
   player.force.reset_technologies()
   player.force.reset_technology_effects()
end
Regarding wood production: The facts are that wood is a very useful material for early industry, but also very annoying to gather in a mod about automation. Wood also has no properly realistic means of production, since it grows so slowly, so it has been troublesome since nearly the beginning of the mod. I like the idea of a semi-automatic machine, which just cuts existing trees nearby, and a while ago I even found another mod (for reference) that did just that - I think it was called Wood Harvester or something similar. However, it's more involved that just imitating the base prototypes like I usually do (again, no great master of the game API here), so I have gotten distracted with more advanced content. Presently, I am open to suggestions: Try scripting a woodcutter? Add some awkward wood production machine? Other ideas? I would like wood to still be difficult enough that there is reason to not simply keep using it through the whole game, which is sort of why I replaced all of its uses by early- or mid-tech. Unfortunately, this issue looks like it won't be easy to fully resolve.
if you want to have some kind of scripted wood cutter to chop down trees in an area pm me and i can get you something put together. for reference i work on the py mods and i do all of the scripting stuff for them so i do have some idea of what im doing.
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 471
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: Quick Update to 3.5.2 & More

Post by Therax »

Repofme1 wrote: Sun Nov 01, 2020 3:57 am I like the idea of a semi-automatic machine, which just cuts existing trees nearby, and a while ago I even found another mod (for reference) that did just that - I think it was called Wood Harvester or something similar. However, it's more involved that just imitating the base prototypes like I usually do (again, no great master of the game API here), so I have gotten distracted with more advanced content. Presently, I am open to suggestions: Try scripting a woodcutter? Add some awkward wood production machine? Other ideas? I would like wood to still be difficult enough that there is reason to not simply keep using it through the whole game, which is sort of why I replaced all of its uses by early- or mid-tech. Unfortunately, this issue looks like it won't be easy to fully resolve.
I don't see a need to reinvent the wheel. Just add something like Lumberjack as an optional dependency, maybe with some recipe tweaks to use appropriate XM materials. Re: early vs. late game, I think the usual technique is just to make the late game recipes vastly more efficient. Or you can have a hard dependency, e.g. you can't make tier 2/3 circuits with wood-based resins, because it's impractical to get them pure enough, so you need to use petroleum derivatives, or possibly use the wood as a feedstock to the same complex processing chain that still makes it more efficient to use the "advanced" recipe.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Quick Update to 3.5.2 & More

Post by eradicator »

Nice to see you're making progress :).
Repofme1 wrote: Sun Nov 01, 2020 3:57 amsomeone also pointed out that the projectile damage technologies don't properly apply the damage bonus to the high-power rifled turret
kingarthur wrote: Sun Nov 01, 2020 11:10 am

Code: Select all

game.reload_script()
for _,player in pairs(game.players) do
   player.force.reset_recipes()
   player.force.reset_technologies()
   player.force.reset_technology_effects()
end
if you want to have some kind of scripted wood cutter to chop down trees in an area pm me and i can get you something put together. for reference i work on the py mods and i do all of the scripting stuff for them so i do have some idea of what im doing.
@kingarthur That is horrible. Pleeease don't iterate players if you mean forces... best case you're doing a lot of redundant work, worst case you're not even fixing forces that currently don't have any players. And you shouldn't reset stuff that's unrelated.

Code: Select all

for _, force in pairs(game.forces) do
  force.reset_technology_effects()
  end
But...

@Repofme1 As far as i understand the factorio engine and your problem: If you're talking about purely prototype/technology based damage bonusses there should be no need to migrate anything because those things are not saved in the first place. You should see the corret bonus in the bonus screen when you load an old world.
Repofme1 wrote: Sun Nov 01, 2020 3:57 am I had made it only 3, because I always thought it would be strange if a low-tier assembling machine could reproduce itself
The base game moved away from using "ingredient count" because that kind of restriction is easier to apply with crafting categories. And there were already recipe category restrictions in addition to count restrictions anyway, so it was very unintuitive for the player in base game.
Repofme1 wrote: Sun Nov 01, 2020 3:57 am Try scripting a woodcutter?
I've made a quick prototype once (Just a proof of concept, please don't use that verbatim). Shouldn't be that much code (unless you want fully animated Lumberjack people running around :p). The question is if that's really the kind of mechanic you want. Being able to place a machine for large-scale deforestation would surely be an interesting method for gaining building space though...:).
Repofme1 wrote: Sun Nov 01, 2020 3:57 am Other ideas?
Maybe some kind of "tree-ore" that only spawns a limited supply in the starting area? Or a tree farm building that requires "raw-wood" (from trees) as fuel/ingredient but only produces "processed-wood" (for recipes). So that it essentially acts as a multiplyer on harvested wood without being fully automatable. (Though if you just want a multiplier you could also just make manual harvesting more rewarding.) Ultimately anyone who really wants to abuse wood forever can just install another mod with cheaper wood production, so i wouldn't overthink it.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

Gun Turret Upgrades

Post by Repofme1 »

Okay, the gun turret bug should be fully fixed. Thanks to kingarthur and eradicator for your help. Looking back, it seems all I really needed was the force.reset_technology_effects() command, which I simply put in a loop in a new lua migration file. I've been iterating over game.forces in my migrations so far, and had even come across the force.reset_recipes() command once or twice, but I was never sure what it did. For some odd reason I thought that it would reset all technologies and recipes to their locked state at the beginning of the game... stupid, I know >.< Still, I appreciate the information - more is better then not enough.
PTTG
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Sat Nov 18, 2017 7:47 pm
Contact:

Re: [MOD 1.0] Xander Mod v3.5.2

Post by PTTG »

Are VSLI wafers used for anything yet? I can't find reference to them?

I work in the field and find the idea of making virtual ones in my off time to be oddly entertaining. I also like the thought of using them to play the silicon lottery -- having to test finished products and getting a random return on the output quality makes for a fun logistical challenge... and means that an inevitable oversupply of low-performance ICs encourage the user to integrate their high-end computer production with low-end circuit boards.

Been enjoying the mod immensely, even though I haven't yet gotten a full production line working yet. Looking forward to hundreds of hours until I get this dang rocket launched.
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 471
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: Gun Turret Upgrades

Post by Therax »

Repofme1 wrote: Tue Nov 03, 2020 2:13 am Okay, the gun turret bug should be fully fixed. Thanks to kingarthur and eradicator for your help. Looking back, it seems all I really needed was the force.reset_technology_effects() command, which I simply put in a loop in a new lua migration file. I've been iterating over game.forces in my migrations so far, and had even come across the force.reset_recipes() command once or twice, but I was never sure what it did. For some odd reason I thought that it would reset all technologies and recipes to their locked state at the beginning of the game... stupid, I know >.< Still, I appreciate the information - more is better then not enough.
I believe there's not a reason to use reset_recipes() or reset_technologies(), and hasn't been since somewhere around Factorio 0.10, because their effects are automatically applied whenever a mod changes the prototypes in the data stage. Using reset_technology_effects() can break certain mods like Long Reach, so it's better to write an actual migration script that's specific to whatever you change.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
PTTG
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Sat Nov 18, 2017 7:47 pm
Contact:

Re: [MOD 1.0] Xander Mod v3.5.2

Post by PTTG »

PTTG wrote: Fri Nov 13, 2020 10:57 am Are VSLI wafers used for anything yet? I can't find reference to them?

I work in the field and find the idea of making virtual ones in my off time to be oddly entertaining. I also like the thought of using them to play the silicon lottery -- having to test finished products and getting a random return on the output quality makes for a fun logistical challenge... and means that an inevitable oversupply of low-performance ICs encourage the user to integrate their high-end computer production with low-end circuit boards.

Been enjoying the mod immensely, even though I haven't yet gotten a full production line working yet. Looking forward to hundreds of hours until I get this dang rocket launched.
I double checked it, VSLI wafers are used to make "Integrated Electronics Components," but THOSE aren't used anywhere as far as I can tell.
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

XM 3.5.3 Out

Post by Repofme1 »

Hi All -

Simply announcing that version 3.5.3 is now up on the mod portal. Rather a lot of changes here:

Bugfixes:
  • Gun turret damage upgrades should be completely fixed
  • Corrected diesel-electric locomotive, car, and tank to accept both crude and chemical fuel
  • Fixed processing unit recipe not having changed from base
Tweaks:
  • Refactored recipe categories and ingredient counts (internal code structure), so that crafting categories govern which recipes a machine is capable of
  • First small lamp recipe uses cast iron machine parts instead of blanks, to represent the feed mechanism in real-life early arc lamps
  • Minimally changed some advanced refining tech so the prerequisites make more sense
  • Corrected violation of conservation of energy in coke production ;) (Doubled coal fuel value from 4 -> 8 MJ, and reduced coke output from 9 to 8)
  • Added braking force 1 as prereq for railway 2
  • Added clay to landfill recipe, to stick everything together
  • Increased polyethylene plastic bar cost by 50%
  • Tweaked recipes: standard transport belt, standard underground belt, fast underground belt, fast splitter
  • Increased wood yield per tree from 4 to 24
  • Halved speed of Kvaerner recipes
New:
  • Rewrought base coal liquefaction
  • Rewrought base rocket fuel
  • Added zirconium
  • Added recycling tech: smelt crude machinery into raw iron, small pylons to copper, and bullets to bronze
  • Completed top two transport belt tiers: added expedited as tier 3, and rewrought base express to be tier 4
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

Re: Gun Turret Upgrades

Post by Repofme1 »

Therax wrote: Fri Nov 13, 2020 7:52 pm
Repofme1 wrote: Tue Nov 03, 2020 2:13 am Okay, the gun turret bug should be fully fixed. Thanks to kingarthur and eradicator for your help. Looking back, it seems all I really needed was the force.reset_technology_effects() command, which I simply put in a loop in a new lua migration file. I've been iterating over game.forces in my migrations so far, and had even come across the force.reset_recipes() command once or twice, but I was never sure what it did. For some odd reason I thought that it would reset all technologies and recipes to their locked state at the beginning of the game... stupid, I know >.< Still, I appreciate the information - more is better then not enough.
I believe there's not a reason to use reset_recipes() or reset_technologies(), and hasn't been since somewhere around Factorio 0.10, because their effects are automatically applied whenever a mod changes the prototypes in the data stage. Using reset_technology_effects() can break certain mods like Long Reach, so it's better to write an actual migration script that's specific to whatever you change.
Oh... I already published version 3.5.3 with those commands in a migration file before I noticed your post. Oops. How bad is this, as in, should I remove the download because it could break save games?

------
Getting to the core issue, of damage upgrades. I'll describe the bug again, in case I was unclear the first time. It starts with the high-power gun turret, which I added to be an upgraded version of the regular turret. The technologies that increase physical projectile damage apply a bonus to the damage of the ammunition being shot, but they also apply an additional bonus to the damage done by gun turrets, on top of the ammo bonus. This is the code I'm looking at:

Code: Select all

type = "technology",
name = "physical-projectile-damage-1",
effects =
{
  {
    type = "ammo-damage",
    ammo_category = "bullet",
    modifier = 0.1
  },
  {
    type = "turret-attack",
    turret_id = "gun-turret",
    modifier = 0.1
  },
  {
    type = "ammo-damage",
    ammo_category = "shotgun-shell",
    modifier = 0.1
  }
},
Since the turret bonus is specific to the base "gun-turret" entity, it didn't apply to my upgraded turret. It is simple enough for me to copy this effect entry for my turret, something like the following, but for all 7 physical-projectile-damage techs:

Code: Select all

  {
    type = "turret-attack",
    turret_id = "gun-turret-2",
    modifier = 0.1
  },
However, I was unaware of the problem for a while, and only added that corret effect recently. Therefore, people (myself included) ended up with worlds which had some damage upgrades already researched, but advanced gun turrets that lacked the correct bonus. Reloading the game or world didn't fix this because (I think) normally the technology effects are only applied when the tech is researched.

So far, I have only worked with recipe unlocks as tech efects, and actually run into the analagous problem several times. When I have to change the recipes unlocked by a technology that has already been researched, I do know this code, to put in a migration file:

Code: Select all

game.reload_script()

for index, force in pairs(game.forces) do
	local technologies = force.technologies
	local recipes = force.recipes

	if recipes["pellets-polyethylene"] and technologies["plastics"] then
		recipes["pellets-polyethylene"].enabled = technologies["plastics"].researched
	end
end
This I understand, since the typical recipe-unlock tech simply changes recipes["name"].unlocked from false to true, and one of you kindly gave me these variable names some while ago.

In the situation of the gun turret, I expect something similar should bepossible, however I don't know the relevant variable names to refer to the game's storage of damage bonuses. I tried to mention this a couple weeks ago, but with the response I got, I thought that reset_technology_effects() was sufficient. It did work in my local world, but I guess that command is not the right way to go... Sorry.

------
This all being said, I'll ask again: can anyone explain a better way to achieve this fix?

------
P.S. I hope my tone didn't come off as too harsh here - I tend to fall back on excessive explanation when I am unsure of things, to help myself pinpoint the gap in knowledge. Please also excuse my relative ignorance of the game's code - I spend most of time thinking about features and gameplay balance.
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

More Bugs...

Post by Repofme1 »

Hi all -

I've run into another bug which I don't know how to fix.

The fast-replace function doesn't work for the Xander Mod chemical reactors, and I'm not sure why. For other machines which upgrade in a series, the entity code seems to simply have the fast_replaceable_group set to one name, which is the same for all entities in that series. This works for not only the base game, but also every relevant machine I have added, except the chemical plants. I have given them all the same line:

fast_replaceable_group = "chemical-plant"

but this doesn't seem to have the same effect as for the others. I did try changing the string to something else - simply "chem" - but that didn't work either. Having quickly exceeded the limits of my minimal knowledge of the game, I'm wondering if anyone else could help - it would be much appreciated.
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

Re: [MOD 1.0] Xander Mod v3.5.2

Post by Repofme1 »

PTTG wrote: Sat Nov 14, 2020 7:50 am
PTTG wrote: Fri Nov 13, 2020 10:57 am Are VSLI wafers used for anything yet? I can't find reference to them?

I work in the field and find the idea of making virtual ones in my off time to be oddly entertaining. I also like the thought of using them to play the silicon lottery -- having to test finished products and getting a random return on the output quality makes for a fun logistical challenge... and means that an inevitable oversupply of low-performance ICs encourage the user to integrate their high-end computer production with low-end circuit boards.

Been enjoying the mod immensely, even though I haven't yet gotten a full production line working yet. Looking forward to hundreds of hours until I get this dang rocket launched.
I double checked it, VSLI wafers are used to make "Integrated Electronics Components," but THOSE aren't used anywhere as far as I can tell.

Hi there!

Glad you're enjoying it :) That's an interesting idea about semi-random output quality, but a bit further than I would like to take the scope of XM right now. Maybe eventually..

The bug was in the recipe for the processing-unit, which should take the integrated components and some other parts, but I accidentally forgot to set it properly. Should be fixed in the latest update.

For reference, I have just finished setting up aluminum, at about 35 hours into my test world. I expect to launch a rocket inside of 100 hours, but then again, I have been trying to move things relatively quick & dirty. There's easily hundreds of hours of fun in a world, now that I've gotten most of the content overhauled. Nuclear is still a big empty chunk though.
Shadow_Man
Fast Inserter
Fast Inserter
Posts: 126
Joined: Fri Mar 02, 2018 2:55 pm
Contact:

Re: XM 3.5.3 Out

Post by Shadow_Man »

Repofme1 wrote: Sun Nov 15, 2020 2:17 am
  • Corrected violation of conservation of energy in coke production ;) (Doubled coal fuel value from 4 -> 8 MJ, and reduced coke output from 9 to 8)
Hmm... Coke is more *condensed* and refined fuel than coal...
Maybe change power distribution to:
Coal - 4 MJ, Coke - 8 MJ, and craft 8 Coal -> 4 Coke.

And High-tension power poles not available to craft.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: More Bugs...

Post by eradicator »

Repofme1 wrote: Sun Nov 15, 2020 3:43 am
Therax wrote: Fri Nov 13, 2020 7:52 pm
Repofme1 wrote: Tue Nov 03, 2020 2:13 am Okay, the gun turret bug should be fully fixed. Thanks to kingarthur and eradicator for your help. Looking back, it seems all I really needed was the force.reset_technology_effects() command, which I simply put in a loop in a new lua migration file. I've been iterating over game.forces in my migrations so far, and had even come across the force.reset_recipes() command once or twice, but I was never sure what it did. For some odd reason I thought that it would reset all technologies and recipes to their locked state at the beginning of the game... stupid, I know >.< Still, I appreciate the information - more is better then not enough.
I believe there's not a reason to use reset_recipes() or reset_technologies(), and hasn't been since somewhere around Factorio 0.10, because their effects are automatically applied whenever a mod changes the prototypes in the data stage. Using reset_technology_effects() can break certain mods like Long Reach, so it's better to write an actual migration script that's specific to whatever you change.
Oh... I already published version 3.5.3 with those commands in a migration file before I noticed your post. Oops. How bad is this, as in, should I remove the download because it could break save games?
Imho it's a bit of a dilemma. Personally i really don't like the sledge hammer approach of "i don't know how to fix it so i'll just reset everything". But the function exists, and there's tons of mods out there who use it, and there's even an event on_technology_effects_reset *just* for that one function. So if mods break due it it being used then i personally consider them as broken as the one that used the function in the first place ;).
Therax wrote: Fri Nov 13, 2020 7:52 pm I believe there's not a reason to use reset_recipes() or reset_technologies(), and hasn't been since somewhere around Factorio 0.10, because their effects are automatically applied whenever a mod changes the prototypes in the data stage.
Can't confirm. Just a few days ago i noticed that adding my stockpiles mod - which adds extra recipes to "stone-walls" tech - to a map where the technology is already researched doesn't enable the recipes. But honestly i'm not even sure how to fix that. I could toggle the techs researched -> false, true, but that might - again - "confuse" some other mods that now recieve the event a second time. But if i just set the recipes to enabled manually then i may break yet another potential mod that might have disabled the recipes on purpose. So as far as i can see it's all a bunch of potentially broken compromises with no proper/clean solution.
Repofme1 wrote: Sun Nov 15, 2020 3:46 am The fast-replace function doesn't work for the Xander Mod chemical reactors,
As far as my limited knowledge on fast replacing goes... the group is just one of several conditions that is needed for it to work. The collosion boxes also have to be the same, and maybe other stuff. But... a quick look at CTRL+SHIFT+F says that the high-pressure reactor doesn't have a group at all. Are you using --check-unused-prototype-data?
Attachments
notfastreplace.png
notfastreplace.png (139.06 KiB) Viewed 6547 times
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
User avatar
Repofme1
Fast Inserter
Fast Inserter
Posts: 180
Joined: Sun Aug 13, 2017 5:22 pm
Contact:

Re: More Bugs...

Post by Repofme1 »

Quote eradicator

Regarding the reset_technology_effects() migration -

I'm not in love with this application of brute force either, but since it only runs once - the first time an old world is loaded with the new mod version, as is the nature of migrations - I consider it acceptable here. Plus, it's not all that much computer processing in the grand scheme of things.

In any case, it's probably too late by now; version 3.5.3 has already been out a few days, with about 150 downloads. Considering XM usually has about 300 per update, I'd say the cat is already out of the bag. In other words, I don't really feel like pursuing this any more.

Regarding recipes not enabled from your stockpiles mod -

This is one thing which I might be able to help you with! I have encountered the same problem many times, mainly from loading an existing world after I had modified a technology, and finding that the changes were not reflected in already-unlocked technologies. Fortunately, the fix is fairly simple. I can't remember off the top of my head who showed me this - likely one of the code-talented people on this thread, thanks whoever you are. When placed in a lua file in the migrations folder of a mod, the following code does pretty much what it looks like - checks if a tech and recipe exist, then sets the locked/unlocked state of the recipe to be the same as that of the technology.

Code: Select all

game.reload_script()

for index, force in pairs(game.forces) do
	local technologies = force.technologies
	local recipes = force.recipes

	if recipes["pellets-polyethylene"] and technologies["plastics"] then
		recipes["pellets-polyethylene"].enabled = technologies["plastics"].researched
	end
end
This is what I meant when I said that I could take care of the gun turret bonus issue - if I knew what variables to reference. Something like, if (damage-tech-1 = researched) then (gun-turret-2.bonus = +10%), but I dunno.

Regarding fast-replace of chemical reactors -

That is already more than I knew about fast-replace, and CTRL+SHIFT+F is also new to me; thank you. That being said, the knowledge that my high-pressure reactor actually lacked a value for the fast-replace group was enough for me to fix it. I simply added another couple lines to my already-sizable file of manual edits. I have to work on getting more of those into loops and functions at some point, but streamlining the code currently takes second priority to getting the content fleshed out.

Idle rambling here: For most of my mod, I use a set of condensed lists to store content, followed by functions which interpret these and add all the details to the base data list. Normally I specify the fast-replace groups for all of my other entities in this same way, but for some reason I guess it doesn't work with the chemical plants. Maybe an issue with my find-replace function... Although I don't understand --check-unused-prototype-data either, for what that's worth.
Post Reply

Return to “Mods”