Window/door placement error


#1

I have a problem with the code for the windows i created as addition to the existing models. I want to place the windows on the ground floor like doors but this doesn’t work as indeed,

I can’t figure out why this problem exist. I used the same code used for the doors/windows but something seems to make problems.

The link to the mod Artis Mod

{
   "type": "entity",
   "mixins": "file(vitrine_large_box_wood_ghost.json)",

   "components": {
  "stonehearth:entity_forms": {
     "iconic_form": "file(vitrine_large_box_wood_iconic.json)",
     "ghost_form": "file(vitrine_large_box_wood_ghost.json)",
     "placeable_on_walls": true,
     "placeable_on_ground": true,
     "hide_placement_ui": false
  },

  "region_collision_shape": {
     "region": [
       {
          "min": { "x": -4.2, "y": 0, "z": -2.5 },
          "max": { "x": 4.2, "y": 4.5, "z": 0.5 }
       }
     ]
  },

  "stonehearth:storage": {
    "type": "crate",
    "capacity": 18,
    "render_contents": true
  },

  "effect_list": {
     "default": "file(/data/rigs/entities/containers/vitrine_large_box/effects/idle.json)"
  }
   },
   "entity_data": {

  "stonehearth:net_worth": {
     "value_in_gold": 32,
     "rarity": "common",
     "shop_info": {
        "buyable": false,
        "sellable": true,
        "shopkeeper_level": 1,
        "shopkeeper_type": "caravan"
     }
  },
  "stonehearth:appeal": {
     "appeal": 26
  },
  "stonehearth:item_quality": {
     "variable_quality": true
  }
   }
}

#2

What does your ghost json look like?


#3

This is the ghost file… @paulthegreat

{
   "mixins": "stonehearth:mixins:placed_object",
   "type": "entity",
   "components": {
      "mob": {
         "align_to_grid": [
            "x"
         ]
      },

      "render_info": {
         "scale": 0.1,
         "animation_table": "file(/data/rigs/entities/containers/vitrine_large_box/vitrine_large_box.json)"
      },

      "model_variants": {
         "default": {
            "models": [
               "file(vitrine_large_box_wood.qb)"
            ]
         }
      },
      "stonehearth:fixture": {
        "valign": "bottom",
         "cursor": "stonehearth:cursors:create_window",
         "margin": {
            "left": 0,
            "right": 0,
            "top": 1
         },
         "bounds": {
            "min": { "x": -3.5, "y": 0 },
            "max": { "x": 3.5, "y": 4 }
         }
      },
      "stonehearth:portal": {
         "cutter": [
            {
               "min": { "x": -3, "y": 0 },
               "max": { "x": 3, "y": 4 }
            }
         ]
      }
   },
   "entity_data": {
      "stonehearth:catalog": {
         "display_name": "i18n(artis:entities.construction.vitrine_large_box_ghost.display_name)",
         "description": "i18n(artis:entities.construction.vitrine_large_box_ghost.description)",
         "icon": "file(vitrine_large_box_wood.png)",
         "category": "window",
         "material_tags": "wood portal crafted window stockpile_portal"
      }
   }
}

#4

Does setting the fixture bottom margin to 0 help? Do the regions graphically correspond to where you think they should via the region debug tool? Does specifying a region_origin help?


#5

@paulthegreat i will try the option with the bottom margin 0 today. The region of the model is already correct, Everything worked fine before the last Radiant SH Update, the final one.


#6

Nope tried also the margin bottom code doesn’t works. Seems that the models is always placed 2 squares above the ground :confused:

Can’t figure out why…

Also the region is fine @paulthegreat


#7

Interesting… so it’s not trying to maintain a bottom margin of 1, it’s trying to remain 2 above ground level. It seems like there’s some sort of collision detection going awry then, but your region looks fine. I wonder if it has something to do with it having a storage component.

If it worked fine before the latest patch, then it’s probably a change in one of these files from the change log:

/mods/stonehearth/components/building2/plan/chunk.lua
/mods/stonehearth/components/building2/plan/jobs/plan_job.lua
/mods/stonehearth/components/building2/scaffolding/scaffolding.lua
/mods/stonehearth/components/building2/scaffolding/scaffolding_set.lua
/mods/stonehearth/components/building2/structure.lua
/mods/stonehearth/lib/building/mutation_utils.lua
/mods/stonehearth/lib/building/wall_map.lua

I’m sorry, but that’s where the extent of my knowledge and contribution end. Perhaps someone from Radiant or someone else more knowledgeable about the building system can help more.


#8

@pingu, I downloaded your mod from the Workshop, and just added

"placeable_on_ground": true,

to the entity forms, and then they were able to place them (I used the placement menu).

Not sure what is happening in your version since the code you show above already has that property set to true.

I also tried adding the model and region origins (which you don’t seem to have in your ghost json file). At first it seemed like it was only placing the window adjacent to walls. The windows usually have this too:

"mob": {
         "mob_collision_type": "clutter"
      },

in the main JSON file, if you want to try that.


#9

Nope @Relyss , unfortunally also this option doesn’t work :frowning: really don’t understand whats wrong with the code…


#10

Can’t really find the problem :smiley:

Maybe i have to try to make it in a different way.


#11

Like I said, the version that is on the workshop can be placed on the ground just by adding the "placeable_on_ground": true, flag :thinking: (I’m on the unstable branch). And hearthlings put items in it too.

BTW, “valign” / “cursor” / “margin” : {} are not in use any more.

“bounds” are necessary.


#12

I missunderstood everything, sorry! Yes, the mob collission solved all the problems. Deleted also all the obsolete code lines. Finally i can update this mod
:heart_eyes:

Thx @Relyss !!!


#13

Yay!!! :star_struck:


#14

Finally the Bugs are fixed & i have also some new vitrine models as clay version for this Update :wink: Let me know what you think.

https://steamcommunity.com/sharedfiles/filedetails/?id=1367159219