Help combining solar panel and accumulator.

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Jcewazhere
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Nov 18, 2014 5:42 am
Contact:

Help combining solar panel and accumulator.

Post by Jcewazhere »

Pre-edit: while typing this post up I found one obvious problem, my control.lua is blank and I have no idea what to put in there. The tutorial on the wiki has some code for making a bomber, and the control.lua's I've looked at in the main game folders don't seem to have code specific to the solar panels.

I'm trying to make a quick and dirty mod that combines a solar panel and an accumulator, making a solar-battery and saving tons of space. I mean it's not like we are in some 2D universe where you can't have stuff on top of other stuff ;)
I've followed the wiki tutorial as close as possible while not making a bomber, but now that I think my mod is complete and want to test it in-game I get an error saying "Error in assignID, 'solar-battery' was not recognized id of entity". I've searched for that error on the forums and found a few things to try but none worked, maybe those fixes were for older game versions or I have an error between the keyboard and my chair.

In my C:\Users\jcewazhere\AppData\Roaming\Factorio\mods folder I have the "solar-battery" folder and mod-list.json. (windows 7 64 bit version)

In the solar-battery folder I have a folder for graphics, I just made a quick solar-battery.png in paint.net, and I have the stock accumlator graphics in a folder as well. Then I have a prototypes folder, and a sound folder. The sounds are direct cut/paste from the basic accumulator.

Then I have control.lua, but I'm not sure what to put there. I've been mostly taking code from the stock items and putting it where I think it needs to go, but the tutorial is for a bomber and the control.lua's from the main game are not very forthcoming with ideas.

Then I have data.lua:
require("prototypes.item")
require("prototypes.recipe")
require("prototypes.entity")
like the tutorial says.

Then I have info.json:
{
"name": "solar-battery",
"version": "0.1.1",
"title": "My first mod",
"author": "Jcewazhere",
"description": "Solar panel and accumulator in the same block space"
}
Inside the prototypes folder I have the following files:

entity.lua
data:extend({
type = "item",
name = "solar-battery",
icon = "__solar-battery__/graphics/icons/solar-battery.png",
flags = {"placeable-neutral", "player-creation"},
minable = {hardness = 0.2, mining_time = 0.5, result = "solar-battery"},
max_health = 100,
corpse = "big-remnants",
collision_box = {{-0.9, -0.9}, {0.9, 0.9}},
selection_box = {{-1, -1}, {1, 1}},
energy_source =
{
type = "electric",
buffer_capacity = "5MJ",
usage_priority = "terciary",
input_flow_limit = "300kW",
output_flow_limit = "300kW"
},
picture =
{
filename = "__solar-battery__/graphics/entity/solar-panel/solar-battery.png",
priority = "extra-high",
width = 124,
height = 103,
shift = {0.7, -0.2}
},

charge_animation =
{
filename = "__solar-battery__/graphics/entity/basic-accumulator/basic-accumulator-charge-animation.png",
width = 138,
height = 135,
line_length = 8,
frame_count = 24,
shift = {0.482, -0.638},
animation_speed = 0.5
},
charge_cooldown = 30,
charge_light = {intensity = 0.3, size = 7},
discharge_animation =
{
filename = "__solar-battery__/graphics/entity/basic-accumulator/basic-accumulator-discharge-animation.png",
width = 147,
height = 128,
line_length = 8,
frame_count = 24,
shift = {0.395, -0.525},
animation_speed = 0.5
},
discharge_cooldown = 60,
discharge_light = {intensity = 0.7, size = 7},
working_sound =
{
sound =
{
filename = "__solar-battery__/sound/accumulator-working.ogg",
volume = 1
},
idle_sound = {
filename = "__solar-battery__/sound/accumulator-idle.ogg",
volume = 0.4
},
max_sounds_per_type = 5
},
production = "60kW"
})

item.lua
data:extend({

{
type = "item",
name = "solar-battery",
icon = "__solar-battery__/graphics/icons/solar-battery.png",
flags = {"goes-to-quickbar"},
subgroup = "energy",
order = "b[solar-battery]-a[solar-battery]",
place_result = "solar-battery",
stack_size = 50
}

})
and finally recipe.lua
extend({
{
type = "recipe",
name = "solar-battery",
enabled = "true",
ingredients =
{
{"steel-plate", 5},
{"electronic-circuit", 15},
{"copper-plate", 5},
{"iron-plate", 2},
{"battery", 5}
},
result = "solar-battery"
}
})
I planned on tweaking things like the crafting recipe, power generation rate and storage once I had it working. Right now I'm just trying to get it to work. Any help would be appreciated, thanks in advance.
I hope spoilers just don't work in the preview, if not I'm sorry for the long post, at least I tried to use them
PS: Whoever decided the text box and the cursor should be the pretty much the same color is a very annoying person :P

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Help combining solar panel and accumulator.

Post by DaveMcW »

Try rearranging data.lua

require("prototypes.entity")
require("prototypes.item")
require("prototypes.recipe")

User avatar
Jcewazhere
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Nov 18, 2014 5:42 am
Contact:

Re: Help combining solar panel and accumulator.

Post by Jcewazhere »

Thanks for the response, but it didn't work.

User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: Help combining solar panel and accumulator.

Post by L0771 »

you have 2 [type="item"] (first add and second modify that item, but you need a entity)
try change type of "entity.lua" to [type = "solar-panel"], maybe it work

User avatar
Jcewazhere
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Nov 18, 2014 5:42 am
Contact:

Re: Help combining solar panel and accumulator.

Post by Jcewazhere »

I changed entity.lua like you suggested, still have the same error.
Thanks anyway.

User avatar
Jcewazhere
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Nov 18, 2014 5:42 am
Contact:

Re: Help combining solar panel and accumulator.

Post by Jcewazhere »

I'm probably over-complicating this, since it's my first real mod I should keep it simple. All I really want to do is add energy storage to a solar panel. I don't need graphics or sounds or custom textures.

starelf
Burner Inserter
Burner Inserter
Posts: 18
Joined: Mon Nov 17, 2014 4:44 am
Contact:

Re: Help combining solar panel and accumulator.

Post by starelf »

The error should also give a line number, or say (near wordincodehere), try either typing out what it says in the error completely, or just take a screenshot of it. From what I see, it's very likely either your folder name does not match the info file, or the order = "b[solar-battery]-a[solar-battery]" doesn't work for custom items unless defined for them. Keep the type="solar-panel" though, pretty sure that might fix some problems.

User avatar
Jcewazhere
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Nov 18, 2014 5:42 am
Contact:

Re: Help combining solar panel and accumulator.

Post by Jcewazhere »

Here's a screenshot of the error, thanks for the reply.

Image

User avatar
Jcewazhere
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Nov 18, 2014 5:42 am
Contact:

Re: Help combining solar panel and accumulator.

Post by Jcewazhere »

Maybe I derped on the folder structure so here's that:

Image

Image

Image

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Help combining solar panel and accumulator.

Post by rk84 »

Entity definition should be in array like in item definition. + your entity type is item.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

Post Reply

Return to “Modding help”