Trying to make a Solar Water Heater, code help please?

Place to get help with not working mods / modding interface.
User avatar
Taehl
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Jan 18, 2015 2:23 am
Contact:

Trying to make a Solar Water Heater, code help please?

Post by Taehl »

Hi, all. I'm still getting used to modding Factorio, and my latest little endeavour has me stumped. I'm trying to make an early-game version of the Solar Panel which doesn't make electricity directly, rather, during the day it acts as a boiler for powering steam engines. My naive guess was that I would need to base it on the "boiler" type, and I'm getting all sorts of odd behaviour. Does anyone know what and how I'm messing up? I'd appreciate the insight.

Code: Select all

data:extend( { {
    type = "boiler",
    name = "solar-boiler",
    icon =  "__Tmod__/graphics/icons/solar-boiler.png",
    flags = {"placeable-neutral", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.5, result = "solar-boiler"},
    corpse = "big-remnants",
    collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
    selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
    vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
    picture =          -- seems to do nothing? graphics are defined in "structure" instead?
    {
      filename = "__Tmod__/graphics/entity/solar-boiler.png",
      priority = "high",
      width = 104,
      height = 96
    },
    fluid_box =          -- later I think I'll make only have two sides with pipes, but right now testing with all four
    {                       -- wouldn't it be fun if players were forced to contend with "L"-shaped plumbing? :D
      base_area = 1,
      pipe_covers = pipecoverspictures(),
      pipe_connections = { {position={0, 2}}, {position = {0, -2}}, {position={2, 0}}, {position = {-2, 0}} }, 
    },
    energy_consumption = "0kW",         -- doesn't consume energy; I was planning on having them add heat using control.lua
    max_health = 35,
    -- these are the pipe pictures - boiler is a pipe as well
    pictures = pipepictures(),
--    fast_replaceable_group = "pipe",
    burner =
    {
      effectivity = 1,
      fuel_inventory_size = 0,         -- you don't put fuel in it
      emissions = 0,                      -- clean energy
      smoke =
      {
        --[[{                   -- don't emit smoke
          name = "smoke",
          position = {0.0, -0.8},
          frequency = 0,
          starting_vertical_speed = 0.0,
          starting_frame_deviation = 60
        }--]]
      }
    },
   structure =         -- this seems... less than efficient
    {
      left =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 104, height = 96, shift = {0, 0},
      },
      down =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 104, height = 96, shift = {0, 0},
      },
      left_down =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 104, height = 96, shift = {0, 0},
      },
      right_down =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 104, height = 96, shift = {0, 0},
      },
      left_up =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 104, height = 96, shift = {0, 0},
      },
      right_up =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 46,
        width = 104, height = 96, shift = {0, 0},
      },
      t_down =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 44,
        width = 104, height = 96, shift = {0, 0},
      },
      t_up =
      {
        filename = "__Tmod__/graphics/entity/solar-boiler.png",
        priority = "extra-high",
        width = 46,
        width = 104, height = 96, shift = {0, 0},
      }
    },
    fire =          -- shouldn't show fire
    { --[[
      left = boilerfires.down,
      down = boilerfires.left,
      left_down = boilerfires.right,
      right_down = boilerfires.left,
      left_up = boilerfires.down,
      right_up = boilerfires.down,
      t_up = boilerfires.down
--]]
    },
    burning_cooldown = 20,		--]]
} } )

data:extend( { 
   {
    type = "item",
    name = "solar-boiler",
    icon = "__base__/graphics/icons/solar-panel.png",
    flags = {"goes-to-quickbar"},
    subgroup = "energy",
    order = "b[steam-power]-a[solar-boiler]",
    place_result = "solar-boiler",
    stack_size = 50
  },
  {
    type = "recipe",
    name = "solar-boiler",
    ingredients =
    {
      {"pipe", 4},
      {"iron-plate", 1},
      {"copper-plate", 4},
    },
    result = "solar-boiler"
  },
 } )
And since they don't have fuel, Factorio gives them the blinking "no fuel" icon, which is less than ideal too.
User avatar
Lutra
Long Handed Inserter
Long Handed Inserter
Posts: 54
Joined: Fri Apr 01, 2016 9:22 pm
Contact:

Re: Trying to make a Solar Water Heater, code help please?

Post by Lutra »

use:

energy_source =
{
type = "electric",
usage_priority = "solar"
}

then maybe

energy_consumption = "1W"


that would make the boiler's heating power vary directly with the in game time, just like solar panels. not entirely sure if it will work, but try anyway(i stole it from the base code for solar panels 8-) )
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
Post Reply

Return to “Modding help”