I'm trying to make a mod that makes longer ranged ammo, to be used with KS combat (since with that, the ammo max range limits the weapon's range, preventing sniper rifles from being usable)
Somehow I managed to get my PC to freeze on load, when my mod's load reaches 9%.
here is the current file.
looking at the task manager while it happens, factorio climbs in memory usage, while 'system' climbs in disk usage.
The reason this is here and not in the bug forum is that I don't know if I should put it there, since it's not the latest version.
Weird issue...(0.17.79)
Weird issue...(0.17.79)
- Attachments
-
- factorio-current.log
- (2.24 KiB) Downloaded 54 times
-
- KS-Combat-sniper-fix_0.0.1.zip
- (1.77 KiB) Downloaded 54 times
Last edited by Mernom on Sun Jan 26, 2020 12:05 pm, edited 1 time in total.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Weird issue... Potentially memory leak? (0.17.79)
Code: Select all
for _, ammo in pairs(data.raw.ammo) do
if ammo.name:find("magazine") and not ammo.name:find("cannon") and not ammo.name:find("shell") then
make_sniper_ammo(ammo.name, {range = 35,speed = 2})
end
end
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Weird issue... (0.17.79)
Ahh! That's true.Thank you for the tip.
Last edited by Mernom on Sun Jan 26, 2020 12:05 pm, edited 1 time in total.
Re: Weird issue... (0.17.79)
Funny thing is, if I went all in on the design, it wouldn't happened since I plan to move the sniper ammo to a different category, and add a different filter to only do the function of "bullet" type ammo.
Edit: How do I manage to do that exactly? Tried ammo.name.ammo_type.caregory:find , but it doesn't idenify ammo_type.
Edit: How do I manage to do that exactly? Tried ammo.name.ammo_type.caregory:find , but it doesn't idenify ammo_type.
Re: Weird issue... (0.17.79)
name is a string? That should give you a "name is not a table" error I think, unless you meant something like data.raw.ammo["name"].ammo_type.category. If you're doing the for _, ammo in pairs(data.raw.ammo) then it'd be ammo.ammo_type.category .Mernom wrote: ↑Sun Jan 26, 2020 11:27 amFunny thing is, if I went all in on the design, it wouldn't happened since I plan to move the sniper ammo to a different category, and add a different filter to only do the function of "bullet" type ammo.
Edit: How do I manage to do that exactly? Tried ammo.name.ammo_type.caregory:find , but it doesn't idenify ammo_type.
It's not relevant during the data phase, but :find is probably not nearly as efficient as == "thing", so if you're using specific terms during the control phase, it'd be better to use == . Just a side comment. Obviously searching within strings you have to use find or match.
I have mods! I guess!
Link
Link
Re: Weird issue...(0.17.79)
I figured out the issue... It was two fold. One, I was looking inside of data.raw.ammo.name.name.
second, ammo prototypes are weirdly structured, with two layers of nameless tables which contain the other properties.
second, ammo prototypes are weirdly structured, with two layers of nameless tables which contain the other properties.