Page 1 of 1

Help with making an entity non-rotateble

Posted: Sat Sep 01, 2018 3:59 pm
by Musical_tanks
Hello I am making a mod and I am having trouble with one item in the code specifically, this one https://lua-api.factorio.com/latest/Lua ... .rotatable

I want to make my entity non-rotatable because its not square and the collision box gets funny (https://i.imgur.com/dOdGQjc.jpg), but it doesn't matter weather the value is set to true or false the entity can still be rotated in game.

Here is the relevant entity code

Code: Select all

data:extend({
    {
        type = "assembling-machine",
        name = "advanced-assembler",
        icon = "__space-lab__/graphic/advanced-assembler-32.png",
        icon_size = 32,
        flags = {"player-creation","placeable-neutral"},
        minable = {hardness = 1.0, mining_time = 2, result = "advanced-assembler"},
        max_health = 500,
        corpse = "big-remnants",
        dying_explosion = "medium-explosion",
        placeable_by = {item="advanced-assembler", count = 1},
        collision_box = {{-3.4, -1.4}, {3.4, 1.4}},
        selection_box = {{-3.4, -1.4}, {3.4, 1.4}},
        drawing_box = {{-3.4, -1.4}, {3.4, 1.4}},
        rotatable  = false,
        animation =
        {
          layers =
          {
            {
            filename = "__space-lab__/graphic/advanced-assembler 210-140.png",
            priority = "extra-high",
            width = 210,
            height = 140,
            shift = {0.0, -0.6},
            frame_count = 1,
            },
          },
        },
        open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
        close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
        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,
         },
        module_specification =
        {
          module_slots = 6,
          module_info_icon_shift = {0, .75},
        },
        crafting_categories =  {"crafting", "advanced-crafting", "satellite-crafting"},
        allowed_effects = {"consumption", "speed", "pollution"},
        ingredient_count = 10,
        crafting_speed = 2,

        order="d-a-a",
        energy_usage = "1MW",
        energy_source =
        {
          type = "electric",
          usage_priority = "secondary-input",
          emissions = 0.08 / 5.5,
        },
    },
})
Am I doing something wrong here?

Re: Help with making an entity non-rotateble

Posted: Sat Sep 01, 2018 4:18 pm
by CyberWizard2261
try

flags = {"player-creation","placeable-neutral", "not-rotatable"}

Re: Help with making an entity non-rotateble

Posted: Sat Sep 01, 2018 4:18 pm
by Bilka
That property you linked can only be used runtime, not in the prototype stage. In the prototype stage, you just have to add "not-rotatable" to the flags of the entity to prevent rotation. You can find the documentation for that here: https://wiki.factorio.com/Types/EntityP ... tatable.22

Re: Help with making an entity non-rotateble

Posted: Sat Sep 01, 2018 4:29 pm
by Musical_tanks
It worked, thank you both!

Re: Help with making an entity non-rotateble

Posted: Mon Sep 03, 2018 11:03 am
by eradicator
Musical_tanks wrote: I want to make my entity non-rotatable because its not square and the collision box gets funny
What is the exact problem you're having? Rectangular entities aren't that rare (all combinators for example), and making a rectangular assember that can be placed only horizontally doesn't seem like the best solution here...

The automatic behavior for rectangular entities is: before placing all four directions are valid, after placing you can only "swap" between two opposite directions.