Giter VIP home page Giter VIP logo

Comments (5)

Nexela avatar Nexela commented on July 26, 2024

Offset is only incorrect if width is > height

from factorio-stdlib.

Nexela avatar Nexela commented on July 26, 2024

Narrowed it down, Current solution, but not sure how much I like it.

--- Converts an entity and its selection_box to the area around it
-- @tparam LuaEntity entity to convert to an area
-- @treturn LuaBoundingBox
function Area.to_selection_area(entity)
    fail_if_missing(entity, "missing entity argument")

    local pos = entity.position
    local bb = entity.prototype.selection_box

    if entity.direction ~= defines.direction.north then
        return Area.rotate(Area.offset(bb, pos))
    end
    return Area.offset(bb, pos)
end

from factorio-stdlib.

Afforess avatar Afforess commented on July 26, 2024

Okay - I think I understand the issue here. The prototype definition is returning the generic bounding box, which apparently is defined for the N-S placement of the entity. Other directions result in the area being rotated 90 degrees, so that's what your check is doing. My only question is: Does the game ever return the direction as south (S-N orientation) and if so, then that should also be checked in your if statement, as N-S and S-N are isomorphic and should not result in rotation.

from factorio-stdlib.

Nexela avatar Nexela commented on July 26, 2024

Will be adjusting this some more tonight.

from factorio-stdlib.

Nexela avatar Nexela commented on July 26, 2024

Ok finally had to time check some 8 way rotations. will have the final fix pushed shortly :)

from factorio-stdlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.