1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 15:00:18 +01:00

Add a simple, but stylish fence gate.

This fence gate builds on NDT_CONNECTED by assuming fence nodes will
automatically connect to it's sides properly. The fence gate will
open and close just like doors, with sounds, but it only opens one
way. The gate sticks out quite a bit and can be bumped into, so the
fence may be used as some sort of path switch.

The fence gate offers no form of protection and can be opened and
closed by anyone. This is done on purpose - the fencegate isn't
meant to provide protection from players, as fences can be
trivially jumped over. Instead, these fences should be used for
protecting crops from hungry sheep, or keeping rabbits in their
pen, or just decoration. Mods can also modify the mod to add
protection, of course.

A recipe is added to make these. It's 4 sticks and 2 wood (any)
as follows:

  stick  wood  stick
  stick  wood  stick

The collision box of the open gate is such that if two gates are
connected but mirrored (making an M shape) then you can walk a large
entity that's larger than 1.0 wide through the opening. The gate of
an opened fence can also be stood upon or bumped into.

I've mixed together some sounds to provide a somewhat light sound
experience, one that one would expect from a small gate latching open
and close.

This change requires #873, otherwise it doesn't connect to fences.
This commit is contained in:
Auke Kok 2016-02-26 07:30:38 -08:00 committed by paramat
parent d979293f14
commit b998ab1b3a
6 changed files with 293 additions and 4 deletions

View File

@ -7,9 +7,10 @@ License of source code:
Copyright (C) 2012 PilzAdam
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
Steel trapdoor added by sofar.
Copyright (C) 2015 sofar@foo-projects.org
Copyright (C) 2016 sofar@foo-projects.org
Re-implemented most of the door algorithms, added meshes, UV wrapped texture
Added doors API to facilitate coding mods accessing and operating doors.
Added Fence Gate model, code, and sounds
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
@ -43,9 +44,6 @@ following textures created by sofar (CC-BY-SA-3.0)
doors_trapdoor_steel_side.png
door_trapdoor_side.png
Door 3d models by sofar (CC-BY-SA-3.0)
door_a.obj
door_b.obj
Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen: WTFPL
door_obsidian_glass.png
@ -57,6 +55,14 @@ All other textures (created by PilzAdam): WTFPL
Door textures were converted to the new texture map by sofar, paramat and
red-001, under the same license as the originals.
Models:
--------------------------------------
Door 3d models by sofar (CC-BY-SA-3.0)
- door_a.obj
- door_b.obj
Fence gate models by sofar (CC-BY-SA-3.0)
- fencegate_open.obj
- fencegate_closed.obj
License of sounds
--------------------------------------
@ -64,3 +70,9 @@ Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen
door_open.ogg
Closing-Sound created by bennstir (CC BY 3.0)
door_close.ogg
fencegate_open.ogg:
http://www.freesound.org/people/mhtaylor67/sounds/126041/ - CC0
fencegate_close.ogg:
http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - CC-BY-3.0
http://www.freesound.org/people/rivernile7/sounds/249573/ - CC-BY-3.0

View File

@ -642,3 +642,62 @@ minetest.register_craft({
}
})
----fence gate----
local fence = {
description = "Fence Gate",
drawtype = "mesh",
tiles = {"default_wood.png"},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
is_ground_content = false,
drop = "doors:gate_closed",
connect_sides = { "left", "right" },
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2,
flammable = 2, fence = 1},
on_rightclick = function(pos, clicker)
local node = minetest.get_node(pos)
local def = minetest.registered_nodes[node.name]
minetest.swap_node(pos, {name = def.gate, param2 = node.param2})
minetest.sound_play(def.sound, {pos = pos, gain = 0.3,
max_hear_distance = 8})
end,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4},
},
}
local fence_closed = table.copy(fence)
fence_closed.mesh = "doors_fencegate_closed.obj"
fence_closed.gate = "doors:gate_open"
fence_closed.sound = "doors_fencegate_open"
fence_closed.collision_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4},
}
local fence_open = table.copy(fence)
fence_open.mesh = "doors_fencegate_open.obj"
fence_open.gate = "doors:gate_closed"
fence_open.sound = "doors_fencegate_close"
fence_open.groups.not_in_creative_inventory = 1
fence_open.collision_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4},
{-5/8, -3/8, -14/16, -3/8, 3/8, 0}},
}
minetest.register_node("doors:gate_closed", fence_closed)
minetest.register_node("doors:gate_open", fence_open)
minetest.register_craft({
output = "doors:gate_closed",
recipe = {
{"default:stick", "group:wood", "default:stick"},
{"default:stick", "group:wood", "default:stick"},
},
})

View File

@ -0,0 +1,106 @@
# Blender v2.76 (sub 0) OBJ File: 'gate_closed.blend'
# www.blender.org
mtllib gate_closed.mtl
o Cube_Cube.001
v -0.625000 -0.500000 0.125000
v -0.625000 0.500000 0.125000
v -0.625000 -0.500000 -0.125000
v -0.625000 0.500000 -0.125000
v -0.375000 -0.500000 0.125000
v -0.375000 0.500000 0.125000
v -0.375000 -0.500000 -0.125000
v -0.375000 0.500000 -0.125000
v 0.375000 -0.500000 0.125000
v 0.375000 0.500000 0.125000
v 0.375000 -0.500000 -0.125000
v 0.375000 0.500000 -0.125000
v 0.625000 -0.500000 0.125000
v 0.625000 0.500000 0.125000
v 0.625000 -0.500000 -0.125000
v 0.625000 0.500000 -0.125000
v -0.375000 0.187500 0.062500
v -0.375000 0.312500 0.062500
v -0.375000 0.187500 -0.062500
v -0.375000 0.312500 -0.062500
v 0.375000 0.187500 0.062500
v 0.375000 0.312500 0.062500
v 0.375000 0.187500 -0.062500
v 0.375000 0.312500 -0.062500
v -0.374831 0.187348 0.062500
v -0.156342 0.187363 0.062500
v -0.374831 0.187348 -0.062500
v -0.156342 0.187363 -0.062500
v 0.374981 -0.343683 0.062500
v 0.375065 -0.187304 0.062500
v 0.374981 -0.343683 -0.062500
v 0.375065 -0.187304 -0.062500
vt 0.000000 0.750000
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt -0.000000 1.000000
vt 1.000000 -0.000000
vt 1.000000 0.250000
vt 0.000000 0.250000
vt -0.000000 0.000000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.250000 0.750000
vt 0.250000 1.000000
vt 0.500000 -0.000000
vt 0.500000 0.250000
vt 0.500000 0.750000
vt 0.500000 1.000000
vt 1.000000 0.625000
vt 0.000000 0.625000
vt 1.000000 0.875000
vt 0.000000 0.875000
vt -0.000000 0.687500
vt 0.000000 0.562500
vt 1.000000 0.562500
vt 1.000000 0.687500
vt 0.813740 0.249033
vt 0.201557 0.249293
vt 0.120995 0.125498
vt 0.987404 0.125469
vt 0.125000 0.375000
vt 0.812500 0.375000
vt 0.937500 0.500000
vt 0.062500 0.500000
vt 0.000000 0.125000
vt 1.000000 0.125000
vt 0.312500 0.437500
vt 0.312500 0.312500
vt 1.000000 0.312500
vt 1.000000 0.437500
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn -0.578000 -0.816100 0.000000
vn 0.576200 0.817300 0.000000
usemtl None
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/4/2 8/5/2 7/6/2 3/1/2
f 8/7/3 6/8/3 5/9/3 7/10/3
f 6/2/4 2/9/4 1/8/4 5/3/4
f 1/9/5 3/10/5 7/11/5 5/12/5
f 6/6/6 8/1/6 4/13/6 2/14/6
f 10/1/1 12/2/1 11/3/1 9/4/1
f 12/2/2 16/9/2 15/8/2 11/3/2
f 16/7/3 14/8/3 13/9/3 15/10/3
f 14/4/4 10/5/4 9/6/4 13/1/4
f 9/12/5 11/11/5 15/15/5 13/16/5
f 14/14/6 16/13/6 12/17/6 10/18/6
f 20/2/2 24/3/2 23/19/2 19/20/2
f 22/1/4 18/4/4 17/21/4 21/22/4
f 17/23/5 19/24/5 23/25/5 21/26/5
f 22/21/6 24/5/6 20/6/6 18/22/6
f 28/27/2 32/28/2 31/29/2 27/30/2
f 30/31/4 26/32/4 25/33/4 29/34/4
f 25/35/7 27/10/7 31/7/7 29/36/7
f 30/37/8 32/38/8 28/39/8 26/40/8

View File

@ -0,0 +1,112 @@
# Blender v2.76 (sub 0) OBJ File: 'gate_open.blend'
# www.blender.org
mtllib gate_open.mtl
o Cube_Cube.001
v -0.625000 -0.500000 0.125000
v -0.625000 0.500000 0.125000
v -0.625000 -0.500000 -0.125000
v -0.625000 0.500000 -0.125000
v -0.375000 -0.500000 0.125000
v -0.375000 0.500000 0.125000
v -0.375000 -0.500000 -0.125000
v -0.375000 0.500000 -0.125000
v 0.375000 -0.500000 0.125000
v 0.375000 0.500000 0.125000
v 0.375000 -0.500000 -0.125000
v 0.375000 0.500000 -0.125000
v 0.625000 -0.500000 0.125000
v 0.625000 0.500000 0.125000
v 0.625000 -0.500000 -0.125000
v 0.625000 0.500000 -0.125000
v 0.434859 0.187500 -0.872359
v 0.434859 0.312500 -0.872359
v 0.559859 0.187500 -0.872359
v 0.559859 0.312500 -0.872359
v 0.434859 0.187500 -0.122359
v 0.434859 0.312500 -0.122359
v 0.559859 0.187500 -0.122359
v 0.559859 0.312500 -0.122359
v 0.434859 0.187348 -0.872190
v 0.434859 0.187363 -0.653701
v 0.559859 0.187348 -0.872190
v 0.559859 0.187363 -0.653701
v 0.434859 -0.343683 -0.122379
v 0.434859 -0.187304 -0.122294
v 0.559859 -0.343683 -0.122379
v 0.559859 -0.187304 -0.122294
v 0.499560 -0.442900 0.005495
vt 0.000000 0.750000
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt -0.000000 1.000000
vt 1.000000 -0.000000
vt 1.000000 0.250000
vt 0.000000 0.250000
vt -0.000000 0.000000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.250000 0.750000
vt 0.250000 1.000000
vt 0.500000 -0.000000
vt 0.500000 0.250000
vt 0.500000 0.750000
vt 0.500000 1.000000
vt 1.000000 0.625000
vt 0.000000 0.625000
vt 1.000000 0.875000
vt 0.000000 0.875000
vt -0.000000 0.687500
vt 0.000000 0.562500
vt 1.000000 0.562500
vt 1.000000 0.687500
vt 0.813740 0.249033
vt 0.201557 0.249293
vt 0.120995 0.125498
vt 0.987404 0.125469
vt 0.125000 0.375000
vt 0.812500 0.375000
vt 0.937500 0.500000
vt 0.062500 0.500000
vt 0.000000 0.125000
vt 1.000000 0.125000
vt 0.312500 0.437500
vt 0.312500 0.312500
vt 1.000000 0.312500
vt 1.000000 0.437500
vt 0.312500 0.625000
vt 0.312500 0.500000
vt 0.187500 0.500000
vt 0.187500 0.625000
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 -0.816100 -0.578000
vn 0.000000 0.817300 0.576200
usemtl None
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/4/2 8/5/2 7/6/2 3/1/2
f 8/7/3 6/8/3 5/9/3 7/10/3
f 6/2/4 2/9/4 1/8/4 5/3/4
f 1/9/5 3/10/5 7/11/5 5/12/5
f 6/6/6 8/1/6 4/13/6 2/14/6
f 10/1/1 12/2/1 11/3/1 9/4/1
f 12/2/2 16/9/2 15/8/2 11/3/2
f 16/7/3 14/8/3 13/9/3 15/10/3
f 14/4/4 10/5/4 9/6/4 13/1/4
f 9/12/5 11/11/5 15/15/5 13/16/5
f 14/14/6 16/13/6 12/17/6 10/18/6
f 20/2/3 24/3/3 23/19/3 19/20/3
f 22/1/1 18/4/1 17/21/1 21/22/1
f 17/23/5 19/24/5 23/25/5 21/26/5
f 22/21/6 24/5/6 20/6/6 18/22/6
f 28/27/3 32/28/3 31/29/3 27/30/3
f 30/31/1 26/32/1 25/33/1 29/34/1
f 25/35/7 27/10/7 31/7/7 29/36/7
f 30/37/8 32/38/8 28/39/8 26/40/8
f 17/41/2 18/42/2 20/43/2 19/44/2

Binary file not shown.

Binary file not shown.