hello hi are you ok?
- User
hello hi are you ok?
Assistant
Hello! Yes, I'm doing well, thank you for asking. How are you doing today?
- User
could you please make lua script to run in minetest and create in front of "me" building like soviet hruschovka with 4 entrance 5 floor. You can use default sand blocks.
Assistant
I'll create a Lua script for Minetest that builds a Soviet Khrushchyovka-style apartment building. This will create a typical 5-floor building with 4 entrances using sand blocks.
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 3 local building_length = 40 -- Length of the building local building_width = 12 -- Width of the building local entrance_width = 3 local entrance_spacing = 10 -- Space between entrances -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure for y = 0, floors * floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = start_pos.y + y, z = start_pos.z + z } -- Create walls (leave space for windows) if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Add windows on long sides if (z == 0 or z == building_width - 1) and y % floor_height == 1 and x % 3 == 1 then minetest.set_node(current_pos, {name = "air"}) else minetest.set_node(current_pos, {name = "default:sand"}) end -- Create floors/ceilings elseif y % floor_height == 0 then minetest.set_node(current_pos, {name = "default:sand"}) else minetest.set_node(current_pos, {name = "air"}) end end end end -- Create 4 entrances for i = 0, 3 do local entrance_x = 5 + (i * entrance_spacing) -- Create entrance doorways for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end -- Create stairwells behind entrances for floor = 0, floors - 1 do for y = 0, floor_height - 1 do for sx = 0, 3 do for sz = 1, 4 do local stair_pos = { x = start_pos.x + entrance_x + sx - 1, y = start_pos.y + (floor * floor_height) + y, z = start_pos.z + sz } -- Create stairwell walls if sx == 0 or sx == 3 or sz == 4 then minetest.set_node(stair_pos, {name = "default:sand"}) else minetest.set_node(stair_pos, {name = "air"}) end end end end end end -- Add a simple roof for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = "default:sand"}) end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built!" end, })To use this script:
- Save it as a
.luafile in your Minetest mods folder (create a new mod folder for it) - Create a
mod.conffile in the same folder with:name = khrushchyovka_builder description = Builds Soviet-style apartment buildings depends = default - Enable the mod in your world
- In-game, type
/khrushchyovkato build the structure in front of you
The script creates a typical Khrushchyovka with:
- 5 floors with 3-block height each
- 4 entrance sections evenly spaced
- Simple window openings on the long sides
- Stairwell areas behind each entrance
- A flat roof
- All built with default sand blocks
The building will appear in front of the direction you're facing when you run the command.
- Save it as a
- User
by the way every entrance is for every 20 flats apartments so it is 80 or so rooms....
Assistant
You're absolutely right! A typical Khrushchyovka has about 20 apartments per entrance (4 apartments per floor × 5 floors), so with 4 entrances that's around 80 apartments total. Let me update the script to create a more realistic layout with actual apartment divisions:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 3 local section_length = 12 -- Length per entrance section local sections = 4 -- Number of entrance sections local building_length = section_length * sections local building_width = 12 -- Width of the building local entrance_width = 2 local apartment_depth = 5 -- Depth of each apartment -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build each section (entrance) for section = 0, sections - 1 do local section_start_x = section * section_length -- Build the floor plan for this section for y = 0, floor_height - 1 do for x = 0, section_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + section_start_x + x, y = base_y + y, z = start_pos.z + z } -- External walls if x == 0 or x == section_length - 1 or z == 0 or z == building_width - 1 then -- Add windows on long sides if (z == 0 or z == building_width - 1) and y == 1 and (x == 2 or x == 5 or x == 8 or x == 10) then minetest.set_node(current_pos, {name = "air"}) else minetest.set_node(current_pos, {name = "default:sand"}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = "default:sand"}) -- Internal layout else -- Central corridor/stairwell area (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls (every 3 blocks along x) elseif x % 3 == 0 and x > 0 and x < section_length - 1 then minetest.set_node(current_pos, {name = "default:sand"}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x - 1) % 3 == 0 and y == 1) then minetest.set_node(current_pos, {name = "default:sand"}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrance on ground floor if floor == 0 then local entrance_x = section_start_x + (section_length / 2) - 1 for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end -- Add section dividing wall (except for last section) if section < sections - 1 then for y = 0, floor_height - 1 do for z = 0, building_width - 1 do local wall_pos = { x = start_pos.x + section_start_x + section_length, y = base_y + y, z = start_pos.z + z } -- Leave corridor open if not (z >= 5 and z <= 6 and y > 0) then minetest.set_node(wall_pos, {name = "default:sand"}) end end end end end end -- Add a simple roof for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = "default:sand"}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_length + (section_length / 2) local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })This updated version creates a more realistic Khrushchyovka with:
- 4 entrance sections, each 12 blocks long
- Central corridor running through the middle of each floor (2 blocks wide)
- 4 apartments per floor per entrance (2 facing front, 2 facing back)
- 20 apartments per entrance (4 per floor × 5 floors)
- 80 total apartments in the building
- Apartment dividing walls every 3 blocks
- Doorways from each apartment to the central corridor
- Windows positioned to match apartment locations
- Optional entrance signs showing apartment numbers (if signs are available)
The layout follows the typical Khrushchyovka design where apartments are accessed from a central corridor, with 2 apartments on each side of the corridor per floor.
- User
this works but ruined too fast may be better use default:desert_sandstone -- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments
local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 3 local section_length = 12 -- Length per entrance section local sections = 4 -- Number of entrance sections local building_length = section_length * sections local building_width = 12 -- Width of the building local entrance_width = 2 local apartment_depth = 5 -- Depth of each apartment
-- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build each section (entrance) for section = 0, sections - 1 do local section_start_x = section * section_length -- Build the floor plan for this section for y = 0, floor_height - 1 do for x = 0, section_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + section_start_x + x, y = base_y + y, z = start_pos.z + z } -- External walls if x == 0 or x == section_length - 1 or z == 0 or z == building_width - 1 then -- Add windows on long sides if (z == 0 or z == building_width - 1) and y == 1 and (x == 2 or x == 5 or x == 8 or x == 10) then minetest.set_node(current_pos, {name = "air"}) else minetest.set_node(current_pos, {name = "default:sand"}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = "default:sand"}) -- Internal layout else -- Central corridor/stairwell area (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls (every 3 blocks along x) elseif x % 3 == 0 and x > 0 and x < section_length - 1 then minetest.set_node(current_pos, {name = "default:sand"}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x - 1) % 3 == 0 and y == 1) then minetest.set_node(current_pos, {name = "default:sand"}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrance on ground floor if floor == 0 then local entrance_x = section_start_x + (section_length / 2) - 1 for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end -- Add section dividing wall (except for last section) if section < sections - 1 then for y = 0, floor_height - 1 do for z = 0, building_width - 1 do local wall_pos = { x = start_pos.x + section_start_x + section_length, y = base_y + y, z = start_pos.z + z } -- Leave corridor open if not (z >= 5 and z <= 6 and y > 0) then minetest.set_node(wall_pos, {name = "default:sand"}) end end end end end end -- Add a simple roof for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = "default:sand"}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_length + (section_length / 2) local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end endend
-- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end
local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end,})
if you can you can improve - only if there is something to improve
Assistant
Good idea! Desert sandstone is much more durable. Here's the improved version with that change and a few other enhancements:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 3 local section_length = 12 -- Length per entrance section local sections = 4 -- Number of entrance sections local building_length = section_length * sections local building_width = 12 -- Width of the building local entrance_width = 2 -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build each section (entrance) for section = 0, sections - 1 do local section_start_x = section * section_length -- Build the floor plan for this section for y = 0, floor_height - 1 do for x = 0, section_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + section_start_x + x, y = base_y + y, z = start_pos.z + z } -- External walls if x == 0 or x == section_length - 1 or z == 0 or z == building_width - 1 then -- Add windows on long sides if (z == 0 or z == building_width - 1) and y == 1 and (x == 2 or x == 5 or x == 8 or x == 10) then -- Use glass if available, otherwise air if minetest.registered_nodes["default:glass"] then minetest.set_node(current_pos, {name = "default:glass"}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor/stairwell area (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls (every 3 blocks along x) elseif x % 3 == 0 and x > 0 and x < section_length - 1 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x - 1) % 3 == 0 and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrance on ground floor if floor == 0 then local entrance_x = section_start_x + (section_length / 2) - 1 for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end -- Add stairs in entrance area if available if minetest.registered_nodes["stairs:stair_desert_sandstone"] then local stair_pos = { x = start_pos.x + entrance_x, y = start_pos.y, z = start_pos.z + 2 } minetest.set_node(stair_pos, {name = "stairs:stair_desert_sandstone", param2 = 0}) end end -- Add section dividing wall (except for last section) if section < sections - 1 then for y = 0, floor_height - 1 do for z = 0, building_width - 1 do local wall_pos = { x = start_pos.x + section_start_x + section_length, y = base_y + y, z = start_pos.z + z } -- Leave corridor open if not (z >= 5 and z <= 6 and y > 0) then minetest.set_node(wall_pos, {name = wall_material}) end end end end end end -- Add a simple roof with slight overhang for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = floor_material}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_length + (section_length / 2) local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add some balconies on the front side (typical for Khrushchyovkas) for floor = 1, floors - 1 do -- Skip ground floor for section = 0, sections - 1 do -- Two balconies per section (apartments 2 and 3) for balcony = 0, 1 do local balcony_x = section * section_length + 4 + (balcony * 6) local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor for bx = 0, 2 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing for bx = 0, 2 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } if minetest.registered_nodes["default:fence_wood"] then minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Key improvements made:
- Changed material to
default:desert_sandstone- much more durable than regular sand - Added glass windows - if glass is available, windows will use glass blocks instead of just air
- Added balconies - typical feature of Khrushchyovkas, with wooden fence railings if available
- Added stairs at entrances if stair blocks are available
- Organized materials into variables at the top for easy customization
- Roof overhang - extends 1 block beyond walls for better weather protection
The building now looks more authentic with balconies on upper floors (2 per entrance section) and proper glass windows. The desert sandstone will last much longer than regular sand blocks.
- Changed material to
- User
that is nice but could you please make - you you know every entrance now has five windows over it. But to the left every entrance have 2 column of windows - one window for kitchen and one for bedroom. Now you made only one "pillar of windows". Also please make apartment with 2x2 windows. Please
Assistant
You're absolutely right! Let me fix the window layout to be more realistic. Each entrance should have apartments on both sides, with proper window arrangements:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 3 local section_length = 12 -- Length per entrance section local sections = 4 -- Number of entrance sections local building_length = section_length * sections local building_width = 12 -- Width of the building local entrance_width = 2 -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build each section (entrance) for section = 0, sections - 1 do local section_start_x = section * section_length -- Build the floor plan for this section for y = 0, floor_height - 1 do for x = 0, section_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + section_start_x + x, y = base_y + y, z = start_pos.z + z } -- External walls if x == 0 or x == section_length - 1 or z == 0 or z == building_width - 1 then -- Windows on front side (z == 0) if z == 0 and y >= 1 and y <= 2 then -- Left side apartments (2 windows each) if (x == 1 or x == 2) or (x == 4 or x == 5) then minetest.set_node(current_pos, {name = window_material}) -- Right side apartments (2 windows each) elseif (x == 7 or x == 8) or (x == 10 or x == 11) then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Windows on back side (z == building_width - 1) elseif z == building_width - 1 and y >= 1 and y <= 2 then -- Same pattern for back apartments if (x == 1 or x == 2) or (x == 4 or x == 5) or (x == 7 or x == 8) or (x == 10 or x == 11) then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor/stairwell area (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls (every 3 blocks along x) elseif x % 3 == 0 and x > 0 and x < section_length - 1 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x - 1) % 3 == 0 and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrance on ground floor if floor == 0 then local entrance_x = section_start_x + (section_length / 2) - 1 for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end -- Add stairs in entrance area if available if minetest.registered_nodes["stairs:stair_desert_sandstone"] then local stair_pos = { x = start_pos.x + entrance_x, y = start_pos.y, z = start_pos.z + 2 } minetest.set_node(stair_pos, {name = "stairs:stair_desert_sandstone", param2 = 0}) end end -- Add section dividing wall (except for last section) if section < sections - 1 then for y = 0, floor_height - 1 do for z = 0, building_width - 1 do local wall_pos = { x = start_pos.x + section_start_x + section_length, y = base_y + y, z = start_pos.z + z } -- Leave corridor open if not (z >= 5 and z <= 6 and y > 0) then minetest.set_node(wall_pos, {name = wall_material}) end end end end end end -- Add a simple roof with slight overhang for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = floor_material}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_length + (section_length / 2) local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add some balconies on the front side (typical for Khrushchyovkas) for floor = 1, floors - 1 do -- Skip ground floor for section = 0, sections - 1 do -- Two balconies per section for balcony = 0, 1 do local balcony_x = section * section_length + 1 + (balcony * 6) local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor for bx = 0, 1 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing for bx = 0, 1 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } if minetest.registered_nodes["default:fence_wood"] then minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end -- Side railings for bz = -2, -1 do for side = 0, 1 do local side_railing_pos = { x = start_pos.x + balcony_x + (side * 1), y = balcony_y + 1, z = start_pos.z + bz } if bz == -2 or (side == 0 and bx == 0) or (side == 1 and bx == 1) then if minetest.registered_nodes["default:fence_wood"] then minetest.set_node(side_railing_pos, {name = "default:fence_wood"}) end end end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Key improvements:
- Proper window layout: Each entrance now has 2 apartments on the left and 2 on the right
- 2x2 windows: Each apartment has a 2x2 window (2 blocks wide, 2 blocks tall)
- Correct window positioning:
- Left side of entrance: windows at positions 1-2 and 4-5
- Right side of entrance: windows at positions 7-8 and 10-11
- This creates the typical pattern where each apartment has one large window
- Windows on both sides: Front and back apartments all have proper 2x2 windows
- Balconies aligned: Balconies are now properly positioned under the apartment windows
The building now has the authentic Khrushchyovka look with the characteristic window pattern - entrance in the middle, two columns of windows on each side!
- User
now it is even more better. Thank you, windows as i ask. But could you make so we have 1 entrance then to the right we have two pillars of windows-apartmnet and two the right two pillars of windows at facade. so between inner entrances we have 4 so called columns of windows. And most left have two "columns" of windows to the left. And the most right entrance has two columns of windows to the right. And one important. the first khruchchyovka window-floor is 1 block from the bottom, but make it 2 blocks from the buildings bottom. Entrance of cause on 0 blocks at bottom as is. Very hope you able to make
Assistant
I understand perfectly! You want the classic Khrushchyovka layout where each entrance has apartments on both sides, creating 4 window columns between entrances. Here's the corrected version:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 3 local apartment_width = 6 -- Each apartment is 6 blocks wide local apartments_per_entrance = 2 -- 2 apartments per side of entrance local entrance_width = 2 local sections = 4 -- Number of entrance sections local section_length = apartment_width * apartments_per_entrance + entrance_width -- 14 blocks per section local building_length = section_length * sections local building_width = 12 -- Width of the building -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build the entire floor for y = 0, floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = base_y + y, z = start_pos.z + z } -- Determine which section we're in local section = math.floor(x / section_length) local x_in_section = x % section_length -- External walls if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Front side windows (z == 0) if z == 0 and y >= 2 and floor > 0 then -- Windows start 2 blocks from floor local is_window = false -- Check if we're in an apartment window area for s = 0, sections - 1 do local section_start = s * section_length local entrance_start = section_start + apartment_width -- Left apartments of this entrance if x >= section_start + 1 and x <= section_start + 2 then is_window = true elseif x >= section_start + 4 and x <= section_start + 5 then is_window = true -- Right apartments of this entrance elseif x >= entrance_start + entrance_width + 1 and x <= entrance_start + entrance_width + 2 then is_window = true elseif x >= entrance_start + entrance_width + 4 and x <= entrance_start + entrance_width + 5 then is_window = true end end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Back side windows (same pattern) elseif z == building_width - 1 and y >= 2 and floor > 0 then local is_window = false for s = 0, sections - 1 do local section_start = s * section_length local entrance_start = section_start + apartment_width if x >= section_start + 1 and x <= section_start + 2 then is_window = true elseif x >= section_start + 4 and x <= section_start + 5 then is_window = true elseif x >= entrance_start + entrance_width + 1 and x <= entrance_start + entrance_width + 2 then is_window = true elseif x >= entrance_start + entrance_width + 4 and x <= entrance_start + entrance_width + 5 then is_window = true end end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Entrance areas elseif x_in_section >= apartment_width and x_in_section < apartment_width + entrance_width and floor == 0 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls elseif x_in_section == 3 or x_in_section == apartment_width or x_in_section == apartment_width + entrance_width + 3 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor local door_x = x_in_section % 3 if not (door_x == 1 and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrances on ground floor if floor == 0 then for section = 0, sections - 1 do local entrance_x = section * section_length + apartment_width for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end end end -- Add a simple roof with slight overhang for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = floor_material}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_length + apartment_width + 1 local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add balconies for floor = 1, floors - 1 do for section = 0, sections - 1 do local section_start = section * section_length -- Left apartment balconies local left_balcony_x = section_start + 1 local right_balcony_x = section_start + apartment_width + entrance_width + 1 for _, balcony_x in ipairs({left_balcony_x, right_balcony_x}) do local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor for bx = 0, 1 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing if minetest.registered_nodes["default:fence_wood"] then for bx = 0, 1 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Key changes made:
- Proper layout: Each entrance has 2 apartments on the left and 2 on the right
- Window columns: Between inner entrances, there are 4 window columns (2 from each side)
- End apartments: Leftmost entrance has 2 columns to the left, rightmost has 2 columns to the right
- Window height: Windows now start 2 blocks from the building bottom (only on floors 2-5, not ground floor)
- Ground floor: Entrances remain at ground level (0 blocks from bottom)
- 2x2 windows: Each apartment has one 2x2 window as requested
The building now has the authentic Soviet Khrushchyovka appearance with the correct window pattern and proportions!
- User
ok cool!. now you really made two columns of windows from every entrance. That
s right. But i mean first floor - every lowest windows - two nodes from buildings bottom. And leave windows 2x2 as you did it before. Over above and beyond entrances please make also windows (so 4 windows over entrance in 5 floor building we have) of stair landing to roof. But no path through between entrances so called columns) Assistant
I understand now! You want the ground floor windows to start 2 blocks up from the ground, and add stairwell windows above each entrance. Here's the corrected version:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 3 local apartment_width = 6 -- Each apartment is 6 blocks wide local apartments_per_entrance = 2 -- 2 apartments per side of entrance local entrance_width = 2 local sections = 4 -- Number of entrance sections local section_length = apartment_width * apartments_per_entrance + entrance_width -- 14 blocks per section local building_length = section_length * sections local building_width = 12 -- Width of the building -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build the entire floor for y = 0, floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = base_y + y, z = start_pos.z + z } -- Determine which section we're in local section = math.floor(x / section_length) local x_in_section = x % section_length -- External walls if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Front side windows (z == 0) if z == 0 and y >= 2 then -- All windows start 2 blocks from floor local is_window = false -- Check if we're in an apartment window area (2x2 windows) for s = 0, sections - 1 do local section_start = s * section_length local entrance_start = section_start + apartment_width -- Left apartments of this entrance if (x >= section_start + 1 and x <= section_start + 2) or (x >= section_start + 4 and x <= section_start + 5) then is_window = true -- Right apartments of this entrance elseif (x >= entrance_start + entrance_width + 1 and x <= entrance_start + entrance_width + 2) or (x >= entrance_start + entrance_width + 4 and x <= entrance_start + entrance_width + 5) then is_window = true -- Stairwell windows above entrances (only floors 2-5) elseif floor > 0 and x >= entrance_start and x <= entrance_start + entrance_width - 1 then is_window = true end end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Back side windows (same pattern, but no stairwell windows) elseif z == building_width - 1 and y >= 2 then local is_window = false for s = 0, sections - 1 do local section_start = s * section_length local entrance_start = section_start + apartment_width if (x >= section_start + 1 and x <= section_start + 2) or (x >= section_start + 4 and x <= section_start + 5) or (x >= entrance_start + entrance_width + 1 and x <= entrance_start + entrance_width + 2) or (x >= entrance_start + entrance_width + 4 and x <= entrance_start + entrance_width + 5) then is_window = true end end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Entrance/stairwell areas elseif x_in_section >= apartment_width and x_in_section < apartment_width + entrance_width then if floor == 0 then minetest.set_node(current_pos, {name = "air"}) else -- Stairwell area on upper floors if z <= 3 then minetest.set_node(current_pos, {name = "air"}) else minetest.set_node(current_pos, {name = wall_material}) end end -- Apartment dividing walls elseif x_in_section == 3 or x_in_section == apartment_width or x_in_section == apartment_width + entrance_width + 3 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor local door_x = x_in_section % 3 if not (door_x == 1 and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrances on ground floor if floor == 0 then for section = 0, sections - 1 do local entrance_x = section * section_length + apartment_width for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end end end -- Add a simple roof with slight overhang for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = floor_material}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_length + apartment_width + 1 local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add balconies for floor = 1, floors - 1 do for section = 0, sections - 1 do local section_start = section * section_length -- Left apartment balconies local left_balcony_x = section_start + 1 local right_balcony_x = section_start + apartment_width + entrance_width + 1 for _, balcony_x in ipairs({left_balcony_x, right_balcony_x}) do local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor for bx = 0, 1 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing if minetest.registered_nodes["default:fence_wood"] then for bx = 0, 1 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Key changes made:
- Ground floor windows: Now start 2 blocks from the building's bottom (even on ground floor)
- 2x2 windows: Kept the 2x2 window size for all apartment windows
- Stairwell windows: Added windows above each entrance on floors 2-5 (4 windows total per entrance)
- Stairwell isolation: Each stairwell is properly separated - no connection between entrance sections
- Window pattern: Maintains the proper Soviet Khrushchyovka look with entrance in center and apartment windows on sides
The building now has the authentic appearance with stairwell windows creating a vertical column above each entrance!
- User
yes good! now make the windows of apartments with 4 glasses nodes - 2x2 please (even the building became higher)
Assistant
I'll modify the code to make proper 2x2 windows for each apartment. This means the building will be taller to accommodate the full-height windows:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 4 -- Increased to accommodate 2x2 windows local apartment_width = 6 -- Each apartment is 6 blocks wide local apartments_per_entrance = 2 -- 2 apartments per side of entrance local entrance_width = 2 local sections = 4 -- Number of entrance sections local section_length = apartment_width * apartments_per_entrance + entrance_width -- 14 blocks per section local building_length = section_length * sections local building_width = 12 -- Width of the building -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build the entire floor for y = 0, floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = base_y + y, z = start_pos.z + z } -- Determine which section we're in local section = math.floor(x / section_length) local x_in_section = x % section_length -- External walls if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Front side windows (z == 0) if z == 0 and (y == 2 or y == 3) then -- 2x2 windows start 2 blocks from floor local is_window = false -- Check if we're in an apartment window area (2x2 windows) for s = 0, sections - 1 do local section_start = s * section_length local entrance_start = section_start + apartment_width -- Left apartments of this entrance (2x2 windows) if (x >= section_start + 1 and x <= section_start + 2) or (x >= section_start + 4 and x <= section_start + 5) then is_window = true -- Right apartments of this entrance (2x2 windows) elseif (x >= entrance_start + entrance_width + 1 and x <= entrance_start + entrance_width + 2) or (x >= entrance_start + entrance_width + 4 and x <= entrance_start + entrance_width + 5) then is_window = true -- Stairwell windows above entrances (only floors 2-5) elseif floor > 0 and x >= entrance_start and x <= entrance_start + entrance_width - 1 then is_window = true end end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Back side windows (same pattern, but no stairwell windows) elseif z == building_width - 1 and (y == 2 or y == 3) then local is_window = false for s = 0, sections - 1 do local section_start = s * section_length local entrance_start = section_start + apartment_width if (x >= section_start + 1 and x <= section_start + 2) or (x >= section_start + 4 and x <= section_start + 5) or (x >= entrance_start + entrance_width + 1 and x <= entrance_start + entrance_width + 2) or (x >= entrance_start + entrance_width + 4 and x <= entrance_start + entrance_width + 5) then is_window = true end end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Entrance/stairwell areas elseif x_in_section >= apartment_width and x_in_section < apartment_width + entrance_width then if floor == 0 then minetest.set_node(current_pos, {name = "air"}) else -- Stairwell area on upper floors if z <= 3 then minetest.set_node(current_pos, {name = "air"}) else minetest.set_node(current_pos, {name = wall_material}) end end -- Apartment dividing walls elseif x_in_section == 3 or x_in_section == apartment_width or x_in_section == apartment_width + entrance_width + 3 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor local door_x = x_in_section % 3 if not (door_x == 1 and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrances on ground floor if floor == 0 then for section = 0, sections - 1 do local entrance_x = section * section_length + apartment_width for y = 0, 2 do for ex = 0, entrance_width - 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end end end -- Add a simple roof with slight overhang for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = floor_material}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_length + apartment_width + 1 local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add balconies for floor = 1, floors - 1 do for section = 0, sections - 1 do local section_start = section * section_length -- Left apartment balconies local left_balcony_x = section_start + 1 local right_balcony_x = section_start + apartment_width + entrance_width + 1 for _, balcony_x in ipairs({left_balcony_x, right_balcony_x}) do local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor for bx = 0, 1 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing if minetest.registered_nodes["default:fence_wood"] then for bx = 0, 1 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Key changes made:
- Floor height increased: Changed from 3 to 4 blocks to accommodate proper 2x2 windows
- True 2x2 windows: Windows now occupy positions y=2 and y=3 on each floor (2 blocks from floor bottom)
- Each apartment window: Is exactly 2x2 blocks (4 glass nodes total)
- Building is taller: Now 20 blocks tall (5 floors × 4 blocks) instead of 15
- Maintained all features: Stairwell windows, proper apartment layout, balconies
The building now has authentic 2x2 windows that give it the proper Soviet Khrushchyovka appearance!
- User
yes fine! Now more and more exactly, better and better thank you. Now let`s make such house at facade
5th floor: node(1 width, 2 height), 3(width)x2(height) glasses window(bedroom), node, 2x2 glassses windows(kitchen), node, window over first entrance, node, 2x2 window, node, 3x2 window,node, 3x2, window, node, 2x2 window, node, window over second entrance, node, kitchen window, node, bedroom window, node, bedroom window, node, kitchen window, node, window over third entrance, node, kitchen window, node, bedroom window, node, bedroom window, node, kitchen window, node, window over fourth entrance, node, kitchen window, node, bedroom window, node. 2...4 floors the same. It make our house wide - it is ok. first floor - also but with entrances arounded nearby with kitchen windows (bedroom windows under bedroom windows of higher floors ). 1 floor windows stiil 2 nodes from ground please . Very ask you)
Assistant
I understand perfectly! You want a more realistic layout with 3x2 bedroom windows and 2x2 kitchen windows. Let me create this authentic Khrushchyovka facade:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 4 -- To accommodate 2-high windows local building_width = 12 -- Width of the building -- Window pattern for each section (between nodes) -- Pattern: node, bedroom(3x2), node, kitchen(2x2), node, entrance_window(2x2), node, kitchen(2x2), node, bedroom(3x2), node local section_width = 1 + 3 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 1 -- 18 blocks per section local sections = 4 local building_length = section_width * sections -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build the entire floor for y = 0, floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = base_y + y, z = start_pos.z + z } -- Determine which section we're in local section = math.floor(x / section_width) local x_in_section = x % section_width -- External walls if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Front side windows (z == 0) if z == 0 and (y == 2 or y == 3) then -- Windows 2 blocks from floor local is_window = false -- Define window positions in each section -- Bedroom window 1 (3x2): positions 1-3 if x_in_section >= 1 and x_in_section <= 3 then is_window = true -- Kitchen window 1 (2x2): positions 5-6 elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true -- Entrance/stairwell window (2x2): positions 8-9 (only floors 2-5) elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 then is_window = true -- Kitchen window 2 (2x2): positions 11-12 elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true -- Bedroom window 2 (3x2): positions 14-16 elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Back side windows (same pattern, but no stairwell windows) elseif z == building_width - 1 and (y == 2 or y == 3) then local is_window = false -- Same window pattern for back apartments if x_in_section >= 1 and x_in_section <= 3 then is_window = true elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Entrance areas on ground floor elseif floor == 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Stairwell areas on upper floors elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls elseif x_in_section == 4 or x_in_section == 7 or x_in_section == 10 or x_in_section == 13 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x_in_section == 2 or x_in_section == 5 or x_in_section == 12 or x_in_section == 15) and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrances on ground floor if floor == 0 then for section = 0, sections - 1 do local entrance_x = section * section_width + 8 for y = 0, 2 do for ex = 0, 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end end end -- Add a simple roof with slight overhang for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = start_pos.y + (floors * floor_height), z = start_pos.z + z } minetest.set_node(roof_pos, {name = floor_material}) end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_width + 8 local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add balconies under bedroom windows for floor = 1, floors - 1 do for section = 0, sections - 1 do local section_start = section * section_width -- Balconies under bedroom windows for _, balcony_x in ipairs({section_start + 1, section_start + 14}) do local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor (3 blocks wide for bedroom) for bx = 0, 2 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing if minetest.registered_nodes["default:fence_wood"] then for bx = 0, 2 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Key features of this authentic Khrushchyovka:
- Exact window pattern as requested: node, 3x2 bedroom, node, 2x2 kitchen, node, 2x2 entrance, node, 2x2 kitchen, node, 3x2 bedroom, node
- Building is now 72 blocks wide (18 blocks per section × 4 sections)
- 3x2 bedroom windows: Larger windows for living rooms/bedrooms
- 2x2 kitchen windows: Smaller windows for kitchens
- Ground floor windows: Still 2 blocks from ground as requested
- Entrances: Positioned next to kitchen windows
- Balconies: Under bedroom windows (3 blocks wide to match window width)
- Stairwell windows: Above each entrance on floors 2-5
This creates the authentic Soviet Khrushchyovka appearance with the characteristic alternating window sizes!
- User
wow so wonderful thanks!!!
Assistant
You're very welcome! I'm so glad you're happy with the result! It was really fun working through all the details to create an authentic Soviet Khrushchyovka - from getting the window patterns just right (with the larger bedroom windows and smaller kitchen windows), to placing the entrances correctly, and making sure those ground floor windows were exactly 2 blocks up.
The building should now look just like the real Khrushchyovkas with their distinctive facade pattern. Enjoy building your Soviet-style neighborhood in Minetest! If you ever want to add more buildings or make any adjustments, feel free to ask.
Happy building! 🏢
- User
if you can i would ask you for something else
Assistant
Of course! I'd be happy to help with something else. What would you like me to help you with?
- User
Let`s touch the roof. Please make the roof surface with default:coalblock. From the facade and back of house let there be cornice with 1 layer over (so we have window, higher one node of desertstone, than layer of coalblock with cornice ). but cornice, on left and right sides of house remove cornice and make like fence but also 1 layer of desert stone. Most left and most right coalblocks cornice do not set live there air, please Possible ?. Other parts of house you can leave untouchable yet.
Assistant
Absolutely! I'll modify the roof to add a coal block surface with cornices on the front and back, and fence-like edges on the sides. Here's the updated code:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 4 -- To accommodate 2-high windows local building_width = 12 -- Width of the building -- Window pattern for each section (between nodes) -- Pattern: node, bedroom(3x2), node, kitchen(2x2), node, entrance_window(2x2), node, kitchen(2x2), node, bedroom(3x2), node local section_width = 1 + 3 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 1 -- 18 blocks per section local sections = 4 local building_length = section_width * sections -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" local roof_material = "default:coalblock" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build the entire floor for y = 0, floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = base_y + y, z = start_pos.z + z } -- Determine which section we're in local section = math.floor(x / section_width) local x_in_section = x % section_width -- External walls if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Front side windows (z == 0) if z == 0 and (y == 2 or y == 3) then -- Windows 2 blocks from floor local is_window = false -- Define window positions in each section -- Bedroom window 1 (3x2): positions 1-3 if x_in_section >= 1 and x_in_section <= 3 then is_window = true -- Kitchen window 1 (2x2): positions 5-6 elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true -- Entrance/stairwell window (2x2): positions 8-9 (only floors 2-5) elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 then is_window = true -- Kitchen window 2 (2x2): positions 11-12 elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true -- Bedroom window 2 (3x2): positions 14-16 elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Back side windows (same pattern, but no stairwell windows) elseif z == building_width - 1 and (y == 2 or y == 3) then local is_window = false -- Same window pattern for back apartments if x_in_section >= 1 and x_in_section <= 3 then is_window = true elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Entrance areas on ground floor elseif floor == 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Stairwell areas on upper floors elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls elseif x_in_section == 4 or x_in_section == 7 or x_in_section == 10 or x_in_section == 13 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x_in_section == 2 or x_in_section == 5 or x_in_section == 12 or x_in_section == 15) and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrances on ground floor if floor == 0 then for section = 0, sections - 1 do local entrance_x = section * section_width + 8 for y = 0, 2 do for ex = 0, 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end end end -- Add desert sandstone layer above top floor local sandstone_y = start_pos.y + (floors * floor_height) for x = 0, building_length - 1 do for z = 0, building_width - 1 do local sandstone_pos = { x = start_pos.x + x, y = sandstone_y, z = start_pos.z + z } minetest.set_node(sandstone_pos, {name = wall_material}) end end -- Add coal block roof with cornices local roof_y = sandstone_y + 1 for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = roof_y, z = start_pos.z + z } -- Front and back cornices (z = -1 and z = building_width) if (z == -1 or z == building_width) and x >= 0 and x < building_length then -- Skip the very first and last blocks if x > 0 and x < building_length - 1 then minetest.set_node(roof_pos, {name = roof_material}) end -- Side edges with fence-like appearance elseif (x == -1 or x == building_length) and z >= 0 and z < building_width then -- Create fence posts every 2 blocks if z % 2 == 0 and minetest.registered_nodes["default:fence_wood"] then local fence_pos = { x = roof_pos.x, y = sandstone_y + 1, z = roof_pos.z } minetest.set_node(fence_pos, {name = "default:fence_wood"}) end -- Main roof surface elseif x >= 0 and x < building_length and z >= 0 and z < building_width then minetest.set_node(roof_pos, {name = roof_material}) end end end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_width + 8 local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add balconies under bedroom windows for floor = 1, floors - 1 do for section = 0, sections - 1 do local section_start = section * section_width -- Balconies under bedroom windows for _, balcony_x in ipairs({section_start + 1, section_start + 14}) do local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor (3 blocks wide for bedroom) for bx = 0, 2 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing if minetest.registered_nodes["default:fence_wood"] then for bx = 0, 2 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Key changes to the roof:
- Desert sandstone layer: Added a full layer of desert sandstone above the top floor
- Coal block roof: The main roof surface is now made of coal blocks
- Front/back cornices: Coal block cornices extend 1 block out on front and back, but skip the very first and last blocks (leaving air at corners)
- Side edges: Instead of cornices, added fence posts every 2 blocks for a fence-like appearance
- Roof structure: Window → desert sandstone layer → coal block roof with cornices
The building now has a proper flat roof with cornices and protective edges!
- User
you are good man - i have no questions to coalblock surface but on the side just make on node higher walls with desert stones, do not use any minetest fences. Just a little higher (1 node) than coalblock surface desert stone wall. That is it
Assistant
Got it! I'll make simple desert sandstone walls on the sides, 1 node higher than the coal block surface. Here's the updated code:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 4 -- To accommodate 2-high windows local building_width = 12 -- Width of the building -- Window pattern for each section (between nodes) -- Pattern: node, bedroom(3x2), node, kitchen(2x2), node, entrance_window(2x2), node, kitchen(2x2), node, bedroom(3x2), node local section_width = 1 + 3 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 1 -- 18 blocks per section local sections = 4 local building_length = section_width * sections -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" local roof_material = "default:coalblock" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build the entire floor for y = 0, floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = base_y + y, z = start_pos.z + z } -- Determine which section we're in local section = math.floor(x / section_width) local x_in_section = x % section_width -- External walls if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Front side windows (z == 0) if z == 0 and (y == 2 or y == 3) then -- Windows 2 blocks from floor local is_window = false -- Define window positions in each section -- Bedroom window 1 (3x2): positions 1-3 if x_in_section >= 1 and x_in_section <= 3 then is_window = true -- Kitchen window 1 (2x2): positions 5-6 elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true -- Entrance/stairwell window (2x2): positions 8-9 (only floors 2-5) elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 then is_window = true -- Kitchen window 2 (2x2): positions 11-12 elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true -- Bedroom window 2 (3x2): positions 14-16 elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Back side windows (same pattern, but no stairwell windows) elseif z == building_width - 1 and (y == 2 or y == 3) then local is_window = false -- Same window pattern for back apartments if x_in_section >= 1 and x_in_section <= 3 then is_window = true elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Entrance areas on ground floor elseif floor == 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Stairwell areas on upper floors elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls elseif x_in_section == 4 or x_in_section == 7 or x_in_section == 10 or x_in_section == 13 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x_in_section == 2 or x_in_section == 5 or x_in_section == 12 or x_in_section == 15) and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrances on ground floor if floor == 0 then for section = 0, sections - 1 do local entrance_x = section * section_width + 8 for y = 0, 2 do for ex = 0, 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end end end -- Add desert sandstone layer above top floor local sandstone_y = start_pos.y + (floors * floor_height) for x = 0, building_length - 1 do for z = 0, building_width - 1 do local sandstone_pos = { x = start_pos.x + x, y = sandstone_y, z = start_pos.z + z } minetest.set_node(sandstone_pos, {name = wall_material}) end end -- Add coal block roof with cornices local roof_y = sandstone_y + 1 for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = roof_y, z = start_pos.z + z } -- Front and back cornices (z = -1 and z = building_width) if (z == -1 or z == building_width) and x >= 0 and x < building_length then -- Skip the very first and last blocks if x > 0 and x < building_length - 1 then minetest.set_node(roof_pos, {name = roof_material}) end -- Main roof surface elseif x >= 0 and x < building_length and z >= 0 and z < building_width then minetest.set_node(roof_pos, {name = roof_material}) end end end -- Add desert sandstone walls on sides (1 node higher than coal block surface) local wall_height = roof_y + 1 for x = 0, building_length - 1 do -- Left side wall local left_wall_pos = { x = start_pos.x + x, y = wall_height, z = start_pos.z } minetest.set_node(left_wall_pos, {name = wall_material}) -- Right side wall local right_wall_pos = { x = start_pos.x + x, y = wall_height, z = start_pos.z + building_width - 1 } minetest.set_node(right_wall_pos, {name = wall_material}) end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_width + 8 local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add balconies under bedroom windows for floor = 1, floors - 1 do for section = 0, sections - 1 do local section_start = section * section_width -- Balconies under bedroom windows for _, balcony_x in ipairs({section_start + 1, section_start + 14}) do local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor (3 blocks wide for bedroom) for bx = 0, 2 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing if minetest.registered_nodes["default:fence_wood"] then for bx = 0, 2 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Perfect! Now the roof has:
- Coal block surface with front/back cornices
- Simple desert sandstone walls on the left and right sides
- Side walls are 1 node higher than the coal block surface
- No fences - just clean desert sandstone parapet walls
The building now has a proper flat roof with protective walls on the sides!
- User
ahaha okay but i need this two lines of desert sone blocks not at facade and back - but i need them at sides left and right of house
Assistant
Oh, I see! You want the desert sandstone walls on the LEFT and RIGHT sides of the building (not front/back). Let me fix that:
-- Soviet Khrushchyovka Building Generator for Minetest -- Creates a 5-floor apartment building with 4 entrances and ~80 apartments local function build_khrushchyovka(pos, player_dir) -- Building dimensions local floors = 5 local floor_height = 4 -- To accommodate 2-high windows local building_width = 12 -- Width of the building -- Window pattern for each section (between nodes) -- Pattern: node, bedroom(3x2), node, kitchen(2x2), node, entrance_window(2x2), node, kitchen(2x2), node, bedroom(3x2), node local section_width = 1 + 3 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 1 -- 18 blocks per section local sections = 4 local building_length = section_width * sections -- Materials local wall_material = "default:desert_sandstone" local floor_material = "default:desert_sandstone" local window_material = minetest.registered_nodes["default:glass"] and "default:glass" or "air" local roof_material = "default:coalblock" -- Calculate starting position based on player direction local start_pos = {x = pos.x, y = pos.y, z = pos.z} -- Adjust position to build in front of player if math.abs(player_dir.x) > math.abs(player_dir.z) then if player_dir.x > 0 then start_pos.x = start_pos.x + 3 else start_pos.x = start_pos.x - building_length - 3 end else if player_dir.z > 0 then start_pos.z = start_pos.z + 3 else start_pos.z = start_pos.z - building_length - 3 end end -- Build the main structure floor by floor for floor = 0, floors - 1 do local base_y = start_pos.y + (floor * floor_height) -- Build the entire floor for y = 0, floor_height - 1 do for x = 0, building_length - 1 do for z = 0, building_width - 1 do local current_pos = { x = start_pos.x + x, y = base_y + y, z = start_pos.z + z } -- Determine which section we're in local section = math.floor(x / section_width) local x_in_section = x % section_width -- External walls if x == 0 or x == building_length - 1 or z == 0 or z == building_width - 1 then -- Front side windows (z == 0) if z == 0 and (y == 2 or y == 3) then -- Windows 2 blocks from floor local is_window = false -- Define window positions in each section -- Bedroom window 1 (3x2): positions 1-3 if x_in_section >= 1 and x_in_section <= 3 then is_window = true -- Kitchen window 1 (2x2): positions 5-6 elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true -- Entrance/stairwell window (2x2): positions 8-9 (only floors 2-5) elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 then is_window = true -- Kitchen window 2 (2x2): positions 11-12 elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true -- Bedroom window 2 (3x2): positions 14-16 elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end -- Back side windows (same pattern, but no stairwell windows) elseif z == building_width - 1 and (y == 2 or y == 3) then local is_window = false -- Same window pattern for back apartments if x_in_section >= 1 and x_in_section <= 3 then is_window = true elseif x_in_section >= 5 and x_in_section <= 6 then is_window = true elseif x_in_section >= 11 and x_in_section <= 12 then is_window = true elseif x_in_section >= 14 and x_in_section <= 16 then is_window = true end if is_window then minetest.set_node(current_pos, {name = window_material}) else minetest.set_node(current_pos, {name = wall_material}) end else minetest.set_node(current_pos, {name = wall_material}) end -- Floor/ceiling elseif y == 0 then minetest.set_node(current_pos, {name = floor_material}) -- Internal layout else -- Central corridor (middle of building) if z >= 5 and z <= 6 then minetest.set_node(current_pos, {name = "air"}) -- Entrance areas on ground floor elseif floor == 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Stairwell areas on upper floors elseif floor > 0 and x_in_section >= 8 and x_in_section <= 9 and z < 4 then minetest.set_node(current_pos, {name = "air"}) -- Apartment dividing walls elseif x_in_section == 4 or x_in_section == 7 or x_in_section == 10 or x_in_section == 13 then minetest.set_node(current_pos, {name = wall_material}) -- Wall between front and back apartments elseif z == 4 or z == 7 then -- Leave doorways to corridor if not ((x_in_section == 2 or x_in_section == 5 or x_in_section == 12 or x_in_section == 15) and y == 1) then minetest.set_node(current_pos, {name = wall_material}) else minetest.set_node(current_pos, {name = "air"}) end else minetest.set_node(current_pos, {name = "air"}) end end end end end -- Create entrances on ground floor if floor == 0 then for section = 0, sections - 1 do local entrance_x = section * section_width + 8 for y = 0, 2 do for ex = 0, 1 do local entrance_pos = { x = start_pos.x + entrance_x + ex, y = start_pos.y + y, z = start_pos.z } minetest.set_node(entrance_pos, {name = "air"}) end end end end end -- Add desert sandstone layer above top floor local sandstone_y = start_pos.y + (floors * floor_height) for x = 0, building_length - 1 do for z = 0, building_width - 1 do local sandstone_pos = { x = start_pos.x + x, y = sandstone_y, z = start_pos.z + z } minetest.set_node(sandstone_pos, {name = wall_material}) end end -- Add coal block roof with cornices local roof_y = sandstone_y + 1 for x = -1, building_length do for z = -1, building_width do local roof_pos = { x = start_pos.x + x, y = roof_y, z = start_pos.z + z } -- Front and back cornices (z = -1 and z = building_width) if (z == -1 or z == building_width) and x >= 0 and x < building_length then -- Skip the very first and last blocks if x > 0 and x < building_length - 1 then minetest.set_node(roof_pos, {name = roof_material}) end -- Main roof surface elseif x >= 0 and x < building_length and z >= 0 and z < building_width then minetest.set_node(roof_pos, {name = roof_material}) end end end -- Add desert sandstone walls on LEFT and RIGHT sides (1 node higher than coal block surface) local wall_height = roof_y + 1 for z = 0, building_width - 1 do -- Left side wall local left_wall_pos = { x = start_pos.x, y = wall_height, z = start_pos.z + z } minetest.set_node(left_wall_pos, {name = wall_material}) -- Right side wall local right_wall_pos = { x = start_pos.x + building_length - 1, y = wall_height, z = start_pos.z + z } minetest.set_node(right_wall_pos, {name = wall_material}) end -- Add entrance numbers (using signs if available) if minetest.registered_nodes["default:sign_wall_wood"] then for section = 0, sections - 1 do local sign_x = section * section_width + 8 local sign_pos = { x = start_pos.x + sign_x, y = start_pos.y + 3, z = start_pos.z - 1 } minetest.set_node(sign_pos, {name = "default:sign_wall_wood", param2 = 0}) local meta = minetest.get_meta(sign_pos) meta:set_string("text", "Entrance " .. (section + 1) .. "\nApts " .. (section * 20 + 1) .. "-" .. ((section + 1) * 20)) end end -- Add balconies under bedroom windows for floor = 1, floors - 1 do for section = 0, sections - 1 do local section_start = section * section_width -- Balconies under bedroom windows for _, balcony_x in ipairs({section_start + 1, section_start + 14}) do local balcony_y = start_pos.y + (floor * floor_height) -- Balcony floor (3 blocks wide for bedroom) for bx = 0, 2 do for bz = -2, -1 do local balcony_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y, z = start_pos.z + bz } minetest.set_node(balcony_pos, {name = floor_material}) end end -- Balcony railing if minetest.registered_nodes["default:fence_wood"] then for bx = 0, 2 do local railing_pos = { x = start_pos.x + balcony_x + bx, y = balcony_y + 1, z = start_pos.z - 2 } minetest.set_node(railing_pos, {name = "default:fence_wood"}) end end end end end end -- Register the command minetest.register_chatcommand("khrushchyovka", { description = "Build a Soviet Khrushchyovka apartment building with 80 apartments", func = function(name) local player = minetest.get_player_by_name(name) if not player then return false, "Player not found" end local pos = player:get_pos() local player_dir = player:get_look_dir() -- Round position to nearest block pos.x = math.floor(pos.x + 0.5) pos.y = math.floor(pos.y + 0.5) pos.z = math.floor(pos.z + 0.5) build_khrushchyovka(pos, player_dir) return true, "Khrushchyovka built! 4 entrances, 80 apartments total." end, })Now fixed! The desert sandstone walls are on the LEFT and RIGHT sides of the building (running along the z-axis), not on the front/back. These walls are 1 node higher than the coal block roof surface, creating proper side parapets!
- User
yes exactly i explained - you are an awesome !!! i will be back soon sorry
Assistant
Thank you so much! I'm really glad we got the Khrushchyovka looking just right with all the authentic details - the proper window layout, the coal block roof with cornices, and those side parapet walls. It was a pleasure working through all the architectural details with you!
Take your time, and feel free to come back whenever you'd like. Whether it's for more Minetest buildings or anything else, I'll be here to help. Enjoy your Soviet apartment building! 😊
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.