[0.13.x] Bob's Mods: General Discussion
Moderator: bobingabout
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.13.x] Bob's Mods: General Discussion
Lithium cobalt oxide is made from Lithium and Cobalt oxide (see cobalt oxide in previous post), in a chemical furnace (or multi-purpose furnace).
The recipe itself is unlocked with the battery 2 research.
The recipe itself is unlocked with the battery 2 research.
Re: [0.13.x] Bob's Mods: General Discussion
How does one load a rail tanker?
Re: [0.13.x] Bob's Mods: General Discussion
Ok, that's what I thought. The recipe is not showing up when I click on either of the correct furnaces and I have completed all the necessary research. However, It does show up on the menu to request items from my logistics network. Here is a screen shot.
- Attachments
-
- Screen Shot 2016-09-08 at 1.25.54 PM.png (3.31 MiB) Viewed 6145 times
Re: [0.13.x] Bob's Mods: General Discussion
I think these are the 4 things you need, not 100% sure as my icons are modded but they look familiar
just use the maginfying glass and search for cobalt and lithium
just use the maginfying glass and search for cobalt and lithium
- Attachments
-
- Screen Shot 2016-09-08 at 1.25.54 PM.png (735.98 KiB) Viewed 6141 times
Re: [0.13.x] Bob's Mods: General Discussion
Blaster wrote:How does one load a rail tanker?
You need to use a regular pump connected directly to the middle of the rail tanker. (2 spots on each side of the tanker for up to 4 pumps total, you don't need all 4 just having 1 in any of the spots will fill it)
- Attachments
-
- tanker.png (346.59 KiB) Viewed 6141 times
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.13.x] Bob's Mods: General Discussion
Rail tankers aren't part of my mod...Blaster wrote:How does one load a rail tanker?
Nexela answered your question anyway.
None of the ones you have highlighted are actually the Lithium Cobalt oxide, which is what he's looking for.Nexela wrote:I think these are the 4 things you need, not 100% sure as my icons are modded but they look familiar
just use the maginfying glass and search for cobalt and lithium
I had to load an older version of the mod, because all my icons are different, and indeed it is missing off that list.
According to everything I'm looking at on my end, once you research Battery 2, you should have access to the material.
My guess is that if you have other mods installed that aren't mine, it is possible that it is also adding battery 2, and removing the unlocks you need. And by the looks of things there, you have some sort of chemistry mod installed. (There's a radiation looking category there anyway)
you can force unlock the recipe like this:
Code: Select all
/c for index, force in pairs(game.forces) do force.recipes["lithium-cobalt-oxide"].enabled = true end
Re: [0.13.x] Bob's Mods: General Discussion
Well that's what I get for trying to go by my faulty memory. I should have just loaded it without graphics mods
Re: [0.13.x] Bob's Mods: General Discussion
[quote="bobingabout"][/quote]
That worked! You are truly a gentleman and scholar. Keep up the good work.
Code: Select all
/c for index, force in pairs(game.forces) do force.recipes["lithium-cobalt-oxide"].enabled = true end
Re: [0.13.x] Bob's Mods: General Discussion
Hi bob,
thx for the correction, but alas there is still a problem :
if machine is nil, the line log(machine .. " does not exist.")
creates an error...
that's what happen when a mod (like my Drones) creates a "player" type with no crafting_categories and no mining_categories (that's the new way to prevent a character from crafting since 0.14).
You can test it by installing my mod (last version), then comment lines 15-16 of drones.lua, and you will see the error in bob library.
But I still do not understand why my "player" type creation triggers your bobmods.lib.machine.has_category function...
thx for the correction, but alas there is still a problem :
Code: Select all
function bobmods.lib.machine.has_category(machine, category_in)
local hasit = false
if machine and machine.crafting_categories then
for i, category in pairs(machine.crafting_categories) do
if category == category_in then
hasit = true
end
end
else
log(machine .. " does not exist.")
end
return hasit
end
creates an error...
that's what happen when a mod (like my Drones) creates a "player" type with no crafting_categories and no mining_categories (that's the new way to prevent a character from crafting since 0.14).
You can test it by installing my mod (last version), then comment lines 15-16 of drones.lua, and you will see the error in bob library.
But I still do not understand why my "player" type creation triggers your bobmods.lib.machine.has_category function...
My mods on the Factorio Mod Portal
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.13.x] Bob's Mods: General Discussion
I think one or more of my mods use this function to scan if assembling machines AND the player has a certain category, and if it does, adds another to the list.binbinhfr wrote:But I still do not understand why my "player" type creation triggers your bobmods.lib.machine.has_category function...
Possibly my electronic hand craftables category.
And those error checks are a pain, they're not very "Safe" and often cause crashes. Maybe I'm just doing it wrong. Though, machine should never be nil anyway, if it is you're using the call wrong. Though, if the issue is that the machine has no crafting categories, that shouldn't effect the log line.
Re: [0.13.x] Bob's Mods: General Discussion
Oh infact I made a mistake in reading the error : machine is not nil, the error is that machine is a table value.bobingabout wrote:Though, machine should never be nil anyway, if it is you're using the call wrong. Though, if the issue is that the machine has no crafting categories, that shouldn't effect the log line.
Code: Select all
log(machine .. " does not exist.")
If you comment this "log" line, everything works fine.
or if you write :
Code: Select all
log(machine.name .. " does not exist.")
To be precise, I am not using any call from your mod at all.
What I do is that I just define a new player type like this :
Code: Select all
data:extend(
{
----------------------------------------------------------------------------------
{
type = "player",
name = "drone-surveillance",
icon = "__Drones__/graphics/drone-surveillance-icon.png",
flags = {"pushable", "placeable-player", "placeable-off-grid", "not-repairable", "not-on-map"},
-- crafting_categories = {"crafting"}, <<<<<<<<<<<<<< COMMENTED
-- mining_categories = {"basic-solid"}, <<<<<<<<<<<<<<<<< COMMENTED
inventory_size = 0,
(...)
Note that my mod works the way it should for players that do not use bob's mod. But as a lot of players are using them, I'd like to find a solution...
My mods on the Factorio Mod Portal
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.13.x] Bob's Mods: General Discussion
Well, of course it crashes if it's a table, it's designed to specifically accept a single entry.
There's 2 ways you can do it for a table:
Option 2, although there is no array version of the check, one of the reasons to do a check is to either add or remove an existing category.
Now, there is no remove category function programmed in currently, but there is an add, and a conditional add... and the conditional add has a table version
bobmods.lib.machine.type_if_add_category(machine_type, category, category_to_add) is the table version of bobmods.lib.machine.if_add_category(machine, category, category_to_add)
However, where the single machine version accepts a link directly to the entry, the array version (with type in the name) expects a type name instead, so accepts a string, not a table, and accesses data.raw[machine_type]
So, Machine type examples are "assembling-machine" and "player", at least, those are the ones I use.
Does that make sense?
There's 2 ways you can do it for a table:
Code: Select all
for i, machine in pairs(<put your table here>) --table can either be entered directly between {}, or can a variable that contains a table.
bobmods.lib.machine.has_category(machine, category) -- value is returned by this line, so do any checks here, it is a check after all
end
Now, there is no remove category function programmed in currently, but there is an add, and a conditional add... and the conditional add has a table version
bobmods.lib.machine.type_if_add_category(machine_type, category, category_to_add) is the table version of bobmods.lib.machine.if_add_category(machine, category, category_to_add)
However, where the single machine version accepts a link directly to the entry, the array version (with type in the name) expects a type name instead, so accepts a string, not a table, and accesses data.raw[machine_type]
So, Machine type examples are "assembling-machine" and "player", at least, those are the ones I use.
Does that make sense?
Re: [0.13.x] Bob's Mods: General Discussion
It makes sense.bobingabout wrote:So, Machine type examples are "assembling-machine" and "player", at least, those are the ones I use.
Does that make sense?
But as I told you, all I do is to declare a new player type (you see it in the code I linked above).
This player type is valid and works perfectly as intended.
I do not mess with your code at all, but apparently it refuses my player definition and I do not understand why...
My mods on the Factorio Mod Portal
Re: [0.13.x] Bob's Mods: General Discussion
My assumption would be that problem is somewhere above in the callstack. I'm guessing that parameter of the call is not a machine even.binbinhfr wrote:It makes sense.bobingabout wrote:So, Machine type examples are "assembling-machine" and "player", at least, those are the ones I use.
Does that make sense?
But as I told you, all I do is to declare a new player type (you see it in the code I linked above).
This player type is valid and works perfectly as intended.
I do not mess with your code at all, but apparently it refuses my player definition and I do not understand why...
Would need to have mod set to figure it out.
Re: [0.13.x] Bob's Mods: General Discussion
Let's go back to the function that poses a problem, because after trying to parse every step of what happens, I always come to the same blocking point that I do not understand :
if you read machine.crafting_categories, doesn't it mean that you assume that machine is infact a table with readable members ?
So it is normal that log(machine.."") has a problem with this table, no ?
Code: Select all
function bobmods.lib.machine.has_category(machine, category_in)
local hasit = false
if machine and machine.crafting_categories then
for i, category in pairs(machine.crafting_categories) do
if category == category_in then
hasit = true
end
end
else
log(machine .. " does not exist.")
end
return hasit
end
So it is normal that log(machine.."") has a problem with this table, no ?
My mods on the Factorio Mod Portal
Re: [0.13.x] Bob's Mods: General Discussion
Bob's function is making incorrect assumptions based on recent api changesorzelek wrote: My assumption would be that problem is somewhere above in the callstack. I'm guessing that parameter of the call is not a machine even.
Would need to have mod set to figure it out.
Binbin is creating a valid entity_table with no crafting_categories. -- this is the correct way to define an entity without these categories
bobs function runs via one of bobsmods and picks up this entity_table
if machine and machine.crafting_categories then -- machine is not nil, but machine.crafting_categories is goto else
else
log(machine) -- Error machine is table
So log line should possibly be changed to log(machine.name .. "has no categories")
but this brings potential problems too but these are a lot more minor
what if machine is passed as a string? or nil.
but as bob said machine shouldn't be nil anyway
Re: [0.13.x] Bob's Mods: General Discussion
Thanks for your analysis that concludes like I do.Nexela wrote:but as bob said machine shouldn't be nil anyway
As I wrote above, I misread the error message : machine was never equal to nil. The error message said it was a table.
EDIT:
infact when I go back in this post, I see that my initial request maybe already contained the solution (i.e. to separate both tests)
Code: Select all
function bobmods.lib.machine.has_category(machine, category_in)
local hasit = false
if machine then
>>> if machine.crafting_categories then
for i, category in pairs(machine.crafting_categories) do
if category == category_in then
hasit = true
end
end
>>> end
else
log(machine .. " does not exist.")
end
return hasit
Bob, would it be ok for you to include this little change ?
My mods on the Factorio Mod Portal
-
- Burner Inserter
- Posts: 5
- Joined: Sat May 02, 2015 10:30 pm
- Contact:
Re: [0.13.x] Bob's Mods: General Discussion
Where is a wiki or other source of information for bob's mods? I want to know the recipes/ores/etc.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [0.13.x] Bob's Mods: General Discussion
I didn't even read all the posts but... it should be:
except, it has to exist to get the name from it.
I think this is left over code from when it would take a name, not an entity table.
I mean, if machine doesn't exist... how can you report it not existing, because it's blank?
I'll just delete these machine log lines...
Code: Select all
log(machine.name .. " does not exist.")
I think this is left over code from when it would take a name, not an entity table.
I mean, if machine doesn't exist... how can you report it not existing, because it's blank?
I'll just delete these machine log lines...
As the mod kept growing and constantly changing, I kinda gave up keeping a record of the recipes etc.elementgermanium wrote:Where is a wiki or other source of information for bob's mods? I want to know the recipes/ores/etc.
Re: [0.13.x] Bob's Mods: General Discussion
Yes that's the good solution. thx bob.bobingabout wrote:I'll just delete these machine log lines...
My mods on the Factorio Mod Portal