Help with making an entity non-rotateble

Place to get help with not working mods / modding interface.
Post Reply
Musical_tanks
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat May 27, 2017 9:19 pm
Contact:

Help with making an entity non-rotateble

Post 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?

CyberWizard2261
Inserter
Inserter
Posts: 23
Joined: Tue Jun 26, 2018 11:01 am
Contact:

Re: Help with making an entity non-rotateble

Post by CyberWizard2261 »

try

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

Bilka
Factorio Staff
Factorio Staff
Posts: 3158
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Help with making an entity non-rotateble

Post 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
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Musical_tanks
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat May 27, 2017 9:19 pm
Contact:

Re: Help with making an entity non-rotateble

Post by Musical_tanks »

It worked, thank you both!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Help with making an entity non-rotateble

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding help”