Rotating assembling machines?

Place to get help with not working mods / modding interface.
Post Reply
Sean Mirrsen
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Apr 27, 2016 6:30 pm
Contact:

Rotating assembling machines?

Post by Sean Mirrsen »

Greetings, modding people of Factorio. I require your help.

I am making some neat machinery here. Unfinished graphics, but that's beside the point.

Image

They work fairly well as-is, but I would really rather like to have them be rotatable before placement. Possibly, if I can script it right, even after placement.

However, they refuse to be rotated. At all.

I have based their setup on the Chemical Plant's, which I know does rotate - the definition looks like this:

Code: Select all

{
    type = "assembling-machine",
    name = "assembly-line-1",
    icon = "__GoofMod__/graphics/icons/Assembline1_icon1.png",
    flags = {"placeable-neutral","placeable-player", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.5, result = "assembly-line-1"},
    max_health = 300,
    corpse = "big-remnants",
    dying_explosion = "medium-explosion",
    collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
    selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
    module_specification =
    {
      module_slots = 4
    },
    allowed_effects = {"consumption", "speed", "productivity", "pollution"},
    animation =
    {
      north =
      {
        filename = "__GoofMod__/graphics/entity/InlineFactory1001.png",
		x = 525,
        width = 175,
        height = 105,
        frame_count = 1,
        shift = {0.75, -0.078125}
      },
      west =
      {
        filename = "__GoofMod__/graphics/entity/InlineFactory1001.png",
        width = 175,
        height = 105,
        frame_count = 1,
        shift = {0.75, -0.078125}
      },
      south =
      {
        filename = "__GoofMod__/graphics/entity/InlineFactory1001.png",
        x = 175,
        width = 175,
        height = 105,
        frame_count = 1,
        shift = {0.75, -0.078125}
      },
      east =
      {
        filename = "__GoofMod__/graphics/entity/InlineFactory1001.png",
        x = 350,
        width = 175,
        height = 105,
        frame_count = 1,
        shift = {0.75, -0.078125}
      }
    },
    vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
    working_sound =
    {
      sound = {
        {
          filename = "__base__/sound/assembling-machine-t2-1.ogg",
          volume = 0.8
        },
        {
          filename = "__base__/sound/assembling-machine-t2-2.ogg",
          volume = 0.8
        }
		},
      idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
      apparent_volume = 1.5,
    },
    crafting_speed = 2.5,
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input",
      emissions = 0.03 / 3.5
    },
    energy_usage = "310kW",
    ingredient_count = 1,
    crafting_categories = {"crafting"},
  }
(yes, goof mod. I'm still sort of goofing around in the modding system. :P)

The only changes I made to the Chemical Plant's definition, besides the graphics and stats, is removing the working visualizations, and the fluidboxes. Somehow that is enough to make the building not be rotatable. Is that a known problem, or am I missing something? Please help. :?

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

Re: Rotating assembling machines?

Post by DaveMcW »

Sean Mirrsen wrote:and the fluidboxes.
Keep the fluidboxes.

Sean Mirrsen
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Apr 27, 2016 6:30 pm
Contact:

Re: Rotating assembling machines?

Post by Sean Mirrsen »

But I don't want fluidboxes. :/

They don't make sense, here, especially on the basic assembly line that takes just one ingredient. Well, unless you count the possibility of unloading oil barrels.... mmmmeh. Okay, let's see if that will do it...

Sean Mirrsen
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Apr 27, 2016 6:30 pm
Contact:

Re: Rotating assembling machines?

Post by Sean Mirrsen »

Okay, I guess this works.

Image

Really hate having to have a pipe on the side there, but I guess there's no helping it for now.
Going to have to adjust the side-view sprites to match Factorio's screwy impression of orthographic projection, too. Why are transport belts as wide going sideways as they are going up and down, if the view angle is 45 degrees down?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5152
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Rotating assembling machines?

Post by Klonan »

Sean Mirrsen wrote: Really hate having to have a pipe on the side there, but I guess there's no helping it for now.
Remove the pipes_cover_pictures and they wont be there

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Rotating assembling machines?

Post by Zeblote »

Sean Mirrsen wrote: Why are transport belts as wide going sideways as they are going up and down, if the view angle is 45 degrees down?
Because factorios projection makes no sense. Most of the graphics are isometric, some aren't, the world itself isn't either... they just got hit home by this with the trains :D

Sean Mirrsen
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Apr 27, 2016 6:30 pm
Contact:

Re: Rotating assembling machines?

Post by Sean Mirrsen »

Klonan wrote:
Sean Mirrsen wrote: Really hate having to have a pipe on the side there, but I guess there's no helping it for now.
Remove the pipes_cover_pictures and they wont be there
Okay, will do.

So, I fixed the visuals matching with the transport belts, by skewing one side of the main body for the side views. Eh. It'll do. Now I have a few more questions, if you'll be so kind. :)

It's pretty obvious, but the design has little to do with slipstream chests' implementation (even if it was inspired by something like that), and it's powered by some hidden ludicrously fast inserters, and a pair of fast transport belts. This, naturally, creates problems with some of the desired features.

Firstly, rotating the building after moving. Ideally I'd want to have that, but apparently it's impossible to just relocate an entity. It needs to be destroyed, then recreated in the new place. As a direct consequence, any items currently riding on the hidden conveyor belts or being held by the hidden inserters when the building is rotated (or destroyed) are lost. That probably should not happen. Preserving the item(s) held by an inserter is fairly easy, but the contents of a conveyor belt are a more arcane construct. Is there a way to just outright copy a conveyor belt's transport lanes to another, or is it necessary to iterate through the contents of the lanes and manually insert them into the new belt?

Second is a less pressing, perhaps, matter, but I was wondering if it's possible to limit a transport belt's length. As in, make a transport belt that only goes half the length of a tile. The purpose being that it's apparently impossible to prevent items from sliding into the depths of the building via collision settings, and when you accidentally put an item that does not match the assembly line's current input there, it might jam the input line without a good way of extracting it short of rebuilding the building. With a half-length belt, all items would be within pickup reach of the player.

Third is probably the least important overall, as quick-replacing these buildings should not really happen that often. But if there's a way to tune collision in such a way that it's possible to use quick-replace without the hidden internal entities blocking the placement of the replacing factory, it'd be neat.

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

Re: Rotating assembling machines?

Post by DaveMcW »

Sean Mirrsen wrote:to just relocate an entity.
http://lua-api.factorio.com/0.12.33/Lua ... l#teleport

Sean Mirrsen
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Apr 27, 2016 6:30 pm
Contact:

Re: Rotating assembling machines?

Post by Sean Mirrsen »

DaveMcW wrote:
Sean Mirrsen wrote:to just relocate an entity.
http://lua-api.factorio.com/0.12.33/Lua ... l#teleport
Pft. "Teleport". Why. -_-
(It has not even occurred to me to look for something like that)

Sean Mirrsen
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Wed Apr 27, 2016 6:30 pm
Contact:

Re: Rotating assembling machines?

Post by Sean Mirrsen »

Apparently transport belts cannot be teleported. Trying to teleport them returns false. Going to root around, see if it's maybe a fixable issue.

Post Reply

Return to “Modding help”