Repository: lord-server/lord
Pull request #2078: Add `gates`. Closes #760
Author: login: blanka-kato
Created: 2025-03-12T07:27:23Z | Merged: 2025-03-26T21:12:40Z

**Описание PR:**

Add `gates` with default MTG model to `lord_wooden_stuff`

**Рекомендации к тесту:**

[<Описание того, что следует протестировать>]

**Дополнительная информация:**

Closes #760 


Linked issue #760: Деревянные блоки: калитки (ворота)


![Image](https://user-images.githubusercontent.com/1972329/188242928-620ca038-3b9b-4dd3-ae49-3afe0fab92c7.png)


Linked issue comments: user: login: alek13
created_at: 2022-09-07T15:43:43Z
body: добавились тут: https://github.com/lord-server/lord/pull/708#issuecomment-1231250926
author_association: MEMBER

Diff:
diff --git a/mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/api.lua b/mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/api.lua
index 669197640..3ff7ced11 100644
--- a/mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/api.lua
+++ b/mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/api.lua
@@ -3,14 +3,15 @@ local register_stick = require("lord_wooden_stuff.register.stick")
 --- Contains wooden stuff type to function accordance
 ---@type table<string,fun()>
 local stuff2func = {
-	["doors"]     = require("lord_wooden_stuff.register.doors"),
-	["hatch"]     = require("lord_wooden_stuff.register.hatch"),
-	["Rhatch"]    = require("lord_wooden_stuff.register.reinforced_hatch"),
-	["fence"]     = require("lord_wooden_stuff.register.fence"),
-	["ladder"]    = require("lord_wooden_stuff.register.ladder"),
-	["stanchion"] = require("lord_wooden_stuff.register.stanchion"),
-	["table"]     = require("lord_wooden_stuff.register.table"),
-	["chair"]     = require("lord_wooden_stuff.register.chair"),
+	["doors"]      = require("lord_wooden_stuff.register.doors"),
+	["hatch"]      = require("lord_wooden_stuff.register.hatch"),
+	["Rhatch"]     = require("lord_wooden_stuff.register.reinforced_hatch"),
+	["fence"]      = require("lord_wooden_stuff.register.fence"),
+	["fence_gate"] = require("lord_wooden_stuff.register.fence_gate"),
+	["ladder"]     = require("lord_wooden_stuff.register.ladder"),
+	["stanchion"]  = require("lord_wooden_stuff.register.stanchion"),
+	["table"]      = require("lord_wooden_stuff.register.table"),
+	["chair"]      = require("lord_wooden_stuff.register.chair"),
 }
 
 --- Registers doors, hatches, fences (with reinforced ones), sticks, ladders, stanchions, tables, chairs of given wood
diff --git a/mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/register/fence_gate.lua b/mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/register/fence_gate.lua
new file mode 100644
index 000000000..be9032ed8
--- /dev/null
+++ b/mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/register/fence_gate.lua
@@ -0,0 +1,16 @@
+local S = require("lord_wooden_stuff.config").translator
+
+--- @param wood       string
+--- @param definition LordWoodenStuffDefinition
+--- @param groups     table<string,number>
+local function register_fence(wood, definition, groups, _)
+	doors.register_fencegate("lord_wooden_stuff:fence_gate_" .. wood, {
+		description = S(definition.desc .. " Fence Gate"),
+		texture = definition.texture,
+		material = definition.wood_name,
+		groups = groups,
+		sounds = default.node_sound_wood_defaults(),
+	})
+end
+
+return register_fence
diff --git a/mods/lord/_overwrites/MTG/doors/models/doors_fencegate_closed.obj b/mods/lord/_overwrites/MTG/doors/models/doors_fencegate_closed.obj
new file mode 100644
index 000000000..cfb368985
--- /dev/null
+++ b/mods/lord/_overwrites/MTG/doors/models/doors_fencegate_closed.obj
@@ -0,0 +1,130 @@
+# Blender 4.4.0
+# www.blender.org
+o cube.004
+v -0.125000 0.312500 0.062500
+v -0.125000 0.312500 -0.062500
+v -0.125000 0.125000 0.062500
+v -0.125000 0.125000 -0.062500
+v -0.375000 0.312500 -0.062500
+v -0.375000 0.312500 0.062500
+v -0.375000 0.125000 -0.062500
+v -0.375000 0.125000 0.062500
+v -0.375000 0.375000 0.062500
+v -0.375000 0.375000 -0.062500
+v -0.375000 -0.312500 0.062500
+v -0.375000 -0.312500 -0.062500
+v -0.500000 0.375000 -0.062500
+v -0.500000 0.375000 0.062500
+v -0.500000 -0.312500 -0.062500
+v -0.500000 -0.312500 0.062500
+v 0.375000 -0.062500 0.062500
+v 0.375000 -0.062500 -0.062500
+v 0.375000 -0.250000 0.062500
+v 0.375000 -0.250000 -0.062500
+v 0.125000 -0.062500 -0.062500
+v 0.125000 -0.062500 0.062500
+v 0.125000 -0.250000 -0.062500
+v 0.125000 -0.250000 0.062500
+v 0.000000 0.312500 0.062500
+v 0.000000 0.312500 -0.062500
+v 0.000000 -0.250000 0.062500
+v 0.000000 -0.250000 -0.062500
+v -0.125000 0.312500 -0.062500
+v -0.125000 0.312500 0.062500
+v -0.125000 -0.250000 -0.062500
+v -0.125000 -0.250000 0.062500
+v 0.500000 0.375000 0.062500
+v 0.500000 0.375000 -0.062500
+v 0.500000 -0.312500 0.062500
+v 0.500000 -0.312500 -0.062500
+v 0.375000 0.375000 -0.062500
+v 0.375000 0.375000 0.062500
+v 0.375000 -0.312500 -0.062500
+v 0.375000 -0.312500 0.062500
+v 0.125000 0.312500 0.062500
+v 0.125000 0.312500 -0.062500
+v 0.125000 -0.250000 0.062500
+v 0.125000 -0.250000 -0.062500
+v 0.000000 0.312500 -0.062500
+v 0.000000 0.312500 0.062500
+v 0.000000 -0.250000 -0.062500
+v 0.000000 -0.250000 0.062500
+v -0.125000 -0.062500 0.062500
+v -0.125000 -0.062500 -0.062500
+v -0.125000 -0.250000 0.062500
+v -0.125000 -0.250000 -0.062500
+v -0.375000 -0.062500 -0.062500
+v -0.375000 -0.062500 0.062500
+v -0.375000 -0.250000 -0.062500
+v -0.375000 -0.250000 0.062500
+v 0.375000 0.312500 0.062500
+v 0.375000 0.312500 -0.062500
+v 0.375000 0.125000 0.062500
+v 0.375000 0.125000 -0.062500
+v 0.125000 0.312500 -0.062500
+v 0.125000 0.312500 0.062500
+v 0.125000 0.125000 -0.062500
+v 0.125000 0.125000 0.062500
+vn -0.0000 -0.0000 -1.0000
+vn -0.0000 -0.0000 1.0000
+vn -0.0000 1.0000 -0.0000
+vn -0.0000 -1.0000 -0.0000
+vn 1.0000 -0.0000 -0.0000
+vn -1.0000 -0.0000 -0.0000
+vt 0.000000 0.812500
+vt 0.250000 0.812500
+vt 0.250000 1.000000
+vt 0.000000 1.000000
+vt 0.000000 0.875000
+vt 0.250000 0.875000
+vt 0.000000 0.312500
+vt 0.125000 0.312500
+vt 0.125000 1.000000
+vt 0.125000 0.875000
+vt 0.500000 0.812500
+vt 0.500000 1.000000
+vt 0.500000 0.875000
+vt 0.000000 0.437500
+vt 0.125000 0.437500
+vt 0.250000 0.312500
+vt 0.250000 0.437500
+s 1
+f 4/1/1 7/2/1 5/3/1 2/4/1
+f 8/1/2 3/2/2 1/3/2 6/4/2
+f 6/5/3 1/6/3 2/3/3 5/4/3
+f 7/5/4 4/6/4 3/3/4 8/4/4
+f 12/7/1 15/8/1 13/9/1 10/4/1
+f 11/7/5 12/8/5 10/9/5 9/4/5
+f 16/7/2 11/8/2 9/9/2 14/4/2
+f 15/7/6 16/8/6 14/9/6 13/4/6
+f 14/5/3 9/10/3 10/9/3 13/4/3
+f 15/5/4 12/10/4 11/9/4 16/4/4
+f 20/2/1 23/11/1 21/12/1 18/3/1
+f 24/2/2 19/11/2 17/12/2 22/3/2
+f 22/6/3 17/13/3 18/12/3 21/3/3
+f 23/6/4 20/13/4 19/12/4 24/3/4
+f 28/14/1 31/15/1 29/9/1 26/4/1
+f 32/14/2 27/15/2 25/9/2 30/4/2
+f 31/14/6 32/15/6 30/9/6 29/4/6
+f 30/5/3 25/10/3 26/9/3 29/4/3
+f 31/5/4 28/10/4 27/9/4 32/4/4
+f 36/8/1 39/16/1 37/3/1 34/9/1
+f 35/8/5 36/16/5 34/3/5 33/9/5
+f 40/8/2 35/16/2 33/3/2 38/9/2
+f 39/8/6 40/16/6 38/3/6 37/9/6
+f 38/10/3 33/6/3 34/3/3 37/9/3
+f 39/10/4 36/6/4 35/3/4 40/9/4
+f 44/15/1 47/17/1 45/3/1 42/9/1
+f 43/15/5 44/17/5 42/3/5 41/9/5
+f 48/15/2 43/17/2 41/3/2 46/9/2
+f 47/15/6 48/17/6 46/3/6 45/9/6
+f 46/10/3 41/6/3 42/3/3 45/9/3
+f 47/10/4 44/6/4 43/3/4 48/9/4
+f 52/1/1 55/2/1 53/3/1 50/4/1
+f 56/1/2 51/2/2 49/3/2 54/4/2
+f 54/5/3 49/6/3 50/3/3 53/4/3
+f 55/5/4 52/6/4 51/3/4 56/4/4
+f 60/2/1 63/11/1 61/12/1 58/3/1
+f 64/2/2 59/11/2 57/12/2 62/3/2
+f 62/6/3 57/13/3 58/12/3 61/3/3
+f 63/6/4 60/13/4 59/12/4 64/3/4
diff --git a/mods/lord/_overwrites/MTG/doors/models/doors_fencegate_open.obj b/mods/lord/_overwrites/MTG/doors/models/doors_fencegate_open.obj
new file mode 100644
index 000000000..8d63e7711
--- /dev/null
+++ b/mods/lord/_overwrites/MTG/doors/models/doors_fencegate_open.obj
@@ -0,0 +1,135 @@
+# Blender 4.4.0
+# www.blender.org
+o cube.007
+v 0.500000 0.312500 0.062500
+v 0.375000 0.312500 0.062500
+v 0.500000 0.125000 0.062500
+v 0.375000 0.125000 0.062500
+v 0.375000 0.312500 0.312500
+v 0.500000 0.312500 0.312500
+v 0.375000 0.125000 0.312500
+v 0.500000 0.125000 0.312500
+v -0.375000 0.375000 0.062500
+v -0.375000 0.375000 -0.062500
+v -0.375000 -0.312500 0.062500
+v -0.375000 -0.312500 -0.062500
+v -0.500000 0.375000 -0.062500
+v -0.500000 0.375000 0.062500
+v -0.500000 -0.312500 -0.062500
+v -0.500000 -0.312500 0.062500
+v 0.500000 -0.062500 0.062500
+v 0.375000 -0.062500 0.062500
+v 0.500000 -0.250000 0.062500
+v 0.375000 -0.250000 0.062500
+v 0.375000 -0.062500 0.312500
+v 0.500000 -0.062500 0.312500
+v 0.375000 -0.250000 0.312500
+v 0.500000 -0.250000 0.312500
+v -0.500000 0.312500 0.437500
+v -0.375000 0.312500 0.437500
+v -0.500000 -0.250000 0.437500
+v -0.375000 -0.250000 0.437500
+v -0.375000 0.312500 0.312500
+v -0.500000 0.312500 0.312500
+v -0.375000 -0.250000 0.312500
+v -0.500000 -0.250000 0.312500
+v 0.500000 0.375000 0.062500
+v 0.500000 0.375000 -0.062500
+v 0.500000 -0.312500 0.062500
+v 0.500000 -0.312500 -0.062500
+v 0.375000 0.375000 -0.062500
+v 0.375000 0.375000 0.062500
+v 0.375000 -0.312500 -0.062500
+v 0.375000 -0.312500 0.062500
+v -0.500000 0.312500 0.312500
+v -0.375000 0.312500 0.312500
+v -0.500000 0.125000 0.312500
+v -0.375000 0.125000 0.312500
+v -0.375000 0.312500 0.062500
+v -0.500000 0.312500 0.062500
+v -0.375000 0.125000 0.062500
+v -0.500000 0.125000 0.062500
+v 0.500000 0.312500 0.312500
+v 0.375000 0.312500 0.312500
+v 0.500000 -0.250000 0.312500
+v 0.375000 -0.250000 0.312500
+v 0.375000 0.312500 0.437500
+v 0.500000 0.312500 0.437500
+v 0.375000 -0.250000 0.437500
+v 0.500000 -0.250000 0.437500
+v -0.500000 -0.062500 0.312500
+v -0.375000 -0.062500 0.312500
+v -0.500000 -0.250000 0.312500
+v -0.375000 -0.250000 0.312500
+v -0.375000 -0.062500 0.062500
+v -0.500000 -0.062500 0.062500
+v -0.375000 -0.250000 0.062500
+v -0.500000 -0.250000 0.062500
+vn -1.0000 -0.0000 -0.0000
+vn 1.0000 -0.0000 -0.0000
+vn -0.0000 1.0000 -0.0000
+vn -0.0000 -1.0000 -0.0000
+vn -0.0000 -0.0000 -1.0000
+vn -0.0000 -0.0000 1.0000
+vt 0.250000 0.812500
+vt 0.500000 0.812500
+vt 0.500000 1.000000
+vt 0.250000 1.000000
+vt 0.250000 0.875000
+vt 0.500000 0.875000
+vt 0.000000 0.312500
+vt 0.125000 0.312500
+vt 0.125000 1.000000
+vt 0.000000 1.000000
+vt 0.000000 0.875000
+vt 0.125000 0.875000
+vt 0.250000 0.437500
+vt 0.375000 0.437500
+vt 0.375000 1.000000
+vt 0.375000 0.875000
+vt 0.250000 0.312500
+vt 0.750000 0.812500
+vt 0.750000 1.000000
+vt 0.750000 0.875000
+vt 0.125000 0.437500
+s 1
+f 4/1/1 7/2/1 5/3/1 2/4/1
+f 8/1/2 3/2/2 1/3/2 6/4/2
+f 6/5/3 1/6/3 2/3/3 5/4/3
+f 7/5/4 4/6/4 3/3/4 8/4/4
+f 12/7/5 15/8/5 13/9/5 10/10/5
+f 11/7/2 12/8/2 10/9/2 9/10/2
+f 16/7/6 11/8/6 9/9/6 14/10/6
+f 15/7/1 16/8/1 14/9/1 13/10/1
+f 14/11/3 9/12/3 10/9/3 13/10/3
+f 15/11/4 12/12/4 11/9/4 16/10/4
+f 20/1/1 23/2/1 21/3/1 18/4/1
+f 24/1/2 19/2/2 17/3/2 22/4/2
+f 22/5/3 17/6/3 18/3/3 21/4/3
+f 23/5/4 20/6/4 19/3/4 24/4/4
+f 28/13/2 31/14/2 29/15/2 26/4/2
+f 27/13/6 28/14/6 26/15/6 25/4/6
+f 32/13/1 27/14/1 25/15/1 30/4/1
+f 31/13/5 32/14/5 30/15/5 29/4/5
+f 30/5/3 25/16/3 26/15/3 29/4/3
+f 31/5/4 28/16/4 27/15/4 32/4/4
+f 36/8/5 39/17/5 37/4/5 34/9/5
+f 35/8/2 36/17/2 34/4/2 33/9/2
+f 40/8/6 35/17/6 33/4/6 38/9/6
+f 39/8/1 40/17/1 38/4/1 37/9/1
+f 38/12/3 33/5/3 34/4/3 37/9/3
+f 39/12/4 36/5/4 35/4/4 40/9/4
+f 44/2/2 47/18/2 45/19/2 42/3/2
+f 48/2/1 43/18/1 41/19/1 46/3/1
+f 46/6/3 41/20/3 42/19/3 45/3/3
+f 47/6/4 44/20/4 43/19/4 48/3/4
+f 52/21/1 55/13/1 53/4/1 50/9/1
+f 51/21/5 52/13/5 50/4/5 49/9/5
+f 56/21/2 51/13/2 49/4/2 54/9/2
+f 55/21/6 56/13/6 54/4/6 53/9/6
+f 54/12/3 49/5/3 50/4/3 53/9/3
+f 55/12/4 52/5/4 51/4/4 56/9/4
+f 60/2/2 63/18/2 61/19/2 58/3/2
+f 64/2/1 59/18/1 57/19/1 62/3/1
+f 62/6/3 57/20/3 58/19/3 61/3/3
+f 63/6/4 60/20/4 59/19/4 64/3/4


Reviews:
user: login: alek13
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-12T11:08:52Z
user: login: alek13
body: LGTM.
модельку ещё ждём ?
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-12T13:13:09Z
user: login: alek13
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-03-26T21:09:49Z
user: login: alek13
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-26T21:10:37Z

Review comments:
diff_hunk: @@ -18,6 +18,14 @@ local function register_fence(wood, def, groups, _)
 		groups = groups,
 		sounds = default.node_sound_wood_defaults()
 	})
+
+	doors.register_fencegate("lord_wooden_stuff:fence_gate_" .. wood, {
path: mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/register/fence.lua
user: login: alek13
body: лучше в отдельный файл вынести `fence_gate.lua`
created_at: 2025-03-12T11:08:52Z
author_association: MEMBER
diff_hunk: @@ -3,14 +3,15 @@ local register_stick = require("lord_wooden_stuff.register.stick")
 --- Contains wooden stuff type to function accordance
 ---@type table<string,fun()>
 local stuff2func = {
-	["doors"]     = require("lord_wooden_stuff.register.doors"),
-	["hatch"]     = require("lord_wooden_stuff.register.hatch"),
-	["Rhatch"]    = require("lord_wooden_stuff.register.reinforced_hatch"),
-	["fence"]     = require("lord_wooden_stuff.register.fence"),
-	["ladder"]    = require("lord_wooden_stuff.register.ladder"),
-	["stanchion"] = require("lord_wooden_stuff.register.stanchion"),
-	["table"]     = require("lord_wooden_stuff.register.table"),
-	["chair"]     = require("lord_wooden_stuff.register.chair"),
+	["doors"]     	= require("lord_wooden_stuff.register.doors"),
+	["hatch"]     	= require("lord_wooden_stuff.register.hatch"),
+	["Rhatch"]    	= require("lord_wooden_stuff.register.reinforced_hatch"),
+	["fence"]     	= require("lord_wooden_stuff.register.fence"),
+	["fence_gate"]	= require("lord_wooden_stuff.register.fence_gate"),
+	["ladder"]    	= require("lord_wooden_stuff.register.ladder"),
+	["stanchion"] 	= require("lord_wooden_stuff.register.stanchion"),
+	["table"]     	= require("lord_wooden_stuff.register.table"),
+	["chair"]     	= require("lord_wooden_stuff.register.chair"),
path: mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/api.lua
user: login: alek13
body: тут тоже табы внутри строки
```suggestion
	["doors"]      = require("lord_wooden_stuff.register.doors"),
	["hatch"]      = require("lord_wooden_stuff.register.hatch"),
	["Rhatch"]     = require("lord_wooden_stuff.register.reinforced_hatch"),
	["fence"]      = require("lord_wooden_stuff.register.fence"),
	["fence_gate"] = require("lord_wooden_stuff.register.fence_gate"),
	["ladder"]     = require("lord_wooden_stuff.register.ladder"),
	["stanchion"]  = require("lord_wooden_stuff.register.stanchion"),
	["table"]      = require("lord_wooden_stuff.register.table"),
	["chair"]      = require("lord_wooden_stuff.register.chair"),
```
created_at: 2025-03-26T21:03:56Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,16 @@
+local S = require("lord_wooden_stuff.config").translator
+
+--- @param wood string
+--- @param def LordWoodenStuffDefinition
+--- @param groups table<string,number>
+local function register_fence(wood, def, groups, _)
path: mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/register/fence_gate.lua
user: login: alek13
body: лучше не сокращать названия переменных и аргументов
created_at: 2025-03-26T21:05:10Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,16 @@
+local S = require("lord_wooden_stuff.config").translator
+
+--- @param wood string
+--- @param def LordWoodenStuffDefinition
+--- @param groups table<string,number>
+local function register_fence(wood, def, groups, _)
+	doors.register_fencegate("lord_wooden_stuff:fence_gate_" .. wood, {
+			description = S(def.desc .. " Fence Gate"),
+			texture = def.texture,
+			material = def.wood_name,
+			groups = groups,
+			sounds = default.node_sound_wood_defaults(),
+	})
path: mods/lord/Blocks/lord_wooden_stuff/src/lord_wooden_stuff/register/fence_gate.lua
user: login: alek13
body: ```suggestion
--- @param wood       string
--- @param definition LordWoodenStuffDefinition
--- @param groups     table<string,number>
local function register_fence(wood, definition, groups, _)
	doors.register_fencegate("lord_wooden_stuff:fence_gate_" .. wood, {
		description = S(definition.desc .. " Fence Gate"),
		texture = definition.texture,
		material = definition.wood_name,
		groups = groups,
		sounds = default.node_sound_wood_defaults(),
	})
```
created_at: 2025-03-26T21:08:32Z
author_association: MEMBER

PR comments:
user: login: blanka-kato
created_at: 2025-03-12T07:28:33Z
body: Новые модели для `fencegate` на проверке у @RodKare1 
author_association: CONTRIBUTOR
user: login: blanka-kato
created_at: 2025-03-26T09:56:51Z
body: Добавил модельки
author_association: CONTRIBUTOR