[Mod] Gates [1.8] [gates]

User avatar
Splizard
Member
 
Posts: 224
Joined: Wed Jan 25, 2012 07:20
Location: New Zealand
GitHub: Splizard
IRC: Splizard
In-game: Splizard

[Mod] Gates [1.8] [gates]

by Splizard » Thu Jan 26, 2012 08:45

This mod adds 3d gates to minetest.
Toggle a gate by clicking on it. Iron gates can be toggled only by mesecon signals.
You can stack the gates to create doors that open with a single click.
They can also be used as windows that open.

Image

Download

Crafting:

Image Image

Image Image

Image Image

3D gates:
Image

If you have xFences mod the fences connect to the short gates:
Image

Video: http://www.youtube.com/watch?v=uZHrin-7lqg (version 1.3)

Minimum Minetest version: 0.4.9
Depends: default, mesecons (optional), xFences (recommended)
License: GPLv2/later
Textures: Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)

Github: https://github.com/Splizard/minetest-mod-gates
Website: http://minetest.splizard.com/mods/gates/ (May not always be online)

Changelog:

Version 1.0
  • Initial release

Version 1.1
  • Added Temperest's code
  • Added Mesecon version
  • Added Readme file

Version 1.2
  • Bugfixes

Version 1.3
  • Added inventory tooltip

Version 1.4
  • Added iron gates in mesecons version
  • Updated textures

Version 1.5
  • Complete rewrite of code
  • Added API for making new gates
  • Fixed iron gate bugs

NOTICE: Version 1.5 is not backwards compatible with the previous versions of this mod!

Version 1.6
  • Added 3D gates

Version 1.8
  • Make iron gates only usable by the placer.
  • Remove mesecon support.
  • Update gates API.
  • Open with right click.

Specific Version links: (Only download these if you need a previous version)
http://splizard.com/mods/gates/gates-1.8.zip (Version 1.8)
http://splizard.com/mods/gates/gates-1.6.zip (Version 1.6)
http://splizard.com/mods/gates/gates-1.5.zip (Version 1.5)
http://splizard.com/mods/gates/gates-1.4.zip (Version 1.4)
http://splizard.com/mods/gates/gates-1.3.zip (Version 1.3)
http://splizard.com/mods/gates/gates-1.2.zip (Version 1.2)
http://splizard.com/mods/gates/gates-1.1.zip (Version 1.1)
http://splizard.com/mods/gates/gates-1.0.zip (Version 1.0)
Attachments
gates.jpg
(310.62 KiB) Not downloaded yet
Last edited by Splizard on Mon Apr 23, 2018 12:03, edited 4 times in total.
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

User avatar
Calinou
Moderator
 
Posts: 3145
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Thu Jan 26, 2012 09:33

Do want in official game. Like it... and it looks fine. :)
 

User avatar
rinoux
Member
 
Posts: 184
Joined: Tue Dec 27, 2011 12:15

by rinoux » Thu Jan 26, 2012 09:37

Thank you for this great mod, my castle will look better.
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu Jan 26, 2012 15:35

+2
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Splizard
Member
 
Posts: 224
Joined: Wed Jan 25, 2012 07:20
Location: New Zealand
GitHub: Splizard
IRC: Splizard
In-game: Splizard

by Splizard » Thu Jan 26, 2012 20:58

Forgot to show the crafting recipe! Fixed now.
I will be keeping the textures as they are now.

Although I would like to be able to open both gates if connected with one click,
any idea how I would go about this?
Somthing similar to how in mesecons, sending power to one item will activate all items attached to the first.
Last edited by Splizard on Thu Jan 26, 2012 20:59, edited 1 time in total.
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Sun Jan 29, 2012 18:10

Splizard wrote:Although I would like to be able to open both gates if connected with one click,
any idea how I would go about this?
Somthing similar to how in mesecons, sending power to one item will activate all items attached to the first.


I've done it:

Code: Select all
-- Local constants
-- This _has_ to be set to 1
local GATE_OPENED = 2
-- This has to be != from GATE_OPENED and is coded on 4 bits
local GATE_CLOSED = 1

-- Local Functions
local on_gate_punched = function(pos, node, puncher)
    if (node.name ~= 'gates:gate_closed')
        and (node.name ~= 'gates:gate_opened') then
        return
    end

    local state = node.param2

    local toggle_gate = function(pos, state)
        local nodename = ""
        local param2 = ""
        -- Switch the gate state when hit
        if state == GATE_OPENED then
            nodename = 'gates:gate_closed'
            param2 = GATE_CLOSED
        elseif state == GATE_CLOSED then
            nodename = 'gates:gate_opened'
            param2 = GATE_OPENED
        else
            print('Uninitialized node: ' .. state)
            return
        end

        minetest.env:add_node(pos, {
            name = nodename,
            param2 = param2,
        })
    end

    toggle_gate(pos, state)

    --handle gates above this one
    local lpos = {x=pos.x, y=pos.y, z=pos.z}
    while true do
        lpos.y = lpos.y+1
        local lnode = minetest.env:get_node(lpos)
        if (lnode.name ~= "gates:gate_closed" and lnode.name ~= "gates:gate_opened") then
            break
        end
        toggle_gate(lpos, state)
    end

    --handle gates below this one
    local lpos = {x=pos.x, y=pos.y, z=pos.z}
    while true do
        lpos.y = lpos.y-1
        local lnode = minetest.env:get_node(lpos)
        if (lnode.name ~= "gates:gate_closed" and lnode.name ~= "gates:gate_opened") then
            break
        end
        toggle_gate(lpos,state)
    end
end

local on_gate_placed = function(pos, node, placer)
    if node.name ~= 'gates:gate_closed' then
        return
    end

    minetest.env:add_node(pos, {
        name = node.name,
        param2 = GATE_OPENED,
    })
end

-- Nodes
-- As long as param2 is set to 1 for open gates, it doesn't matter to
-- use drawtype = 'signlike'
minetest.register_node('gates:gate_opened', {
    drawtype = 'plantlike',
    visual_scale = 1.5,
    tile_images = {'gate_open.png'},
    sunlight_propagates = true,
    paramtype = 'light',
    walkable = false,
    material = minetest.digprop_constanttime(1.0),
    drop = "gates:gate_closed",
})

minetest.register_node('gates:gate_closed', {
    tile_images = {'gate_top.png','gate_top.png','gate.png'},
    sunlight_propagates = true,
    paramtype = 'light',
    walkable = true,
    material = minetest.digprop_constanttime(1.0),
})

-- Crafts
minetest.register_craft({
    output = '"gates:gate_closed" 2',
    recipe = {
        {"default:stick", "default:wood", "default:stick"},
        {"default:stick", "default:wood", "default:stick"},
    },
})

-- Change the gate state
minetest.register_on_punchnode(on_gate_punched)
-- Reset param2 for open gates
minetest.register_on_placenode(on_gate_placed)

-- Mesecon Stuff:
--mesecon:register_on_signal_on(on_gate_punched)
--mesecon:register_on_signal_off(on_gate_punched)

print("[Gates] Loaded!")


Punching a gate node now opens or closes all nodes above or below it. Also fixed a bug with the on_placenode routine.

Just place two or more gates an top of each other and punching any of them will toggle the gate state.

Speaking of mesecons, I've tried to add mesecon actuation (commented out at the bottom), but it fails because the name "mesecons" is nil. It's unusual since the hatches mod had worked just fine.
Last edited by Temperest on Sun Jan 29, 2012 18:11, edited 1 time in total.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
Splizard
Member
 
Posts: 224
Joined: Wed Jan 25, 2012 07:20
Location: New Zealand
GitHub: Splizard
IRC: Splizard
In-game: Splizard

by Splizard » Sun Jan 29, 2012 22:07

Thank you Temperest
the mod is now updated with your code :)

The reason that mesecons returns nil is because jeija needs to be added to depends.txt
I have included the mesecon version in the mod.
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

User avatar
neko259
Member
 
Posts: 792
Joined: Sun Jun 19, 2011 06:51

by neko259 » Sun Jan 29, 2012 22:21

This mod is great! I use it for doors, but it's more universal.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Splizard
Member
 
Posts: 224
Joined: Wed Jan 25, 2012 07:20
Location: New Zealand
GitHub: Splizard
IRC: Splizard
In-game: Splizard

by Splizard » Mon Jan 30, 2012 02:08

Version 1.2
Fixed a bug: While creating a gate another gate would appear on top of the original gate.
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Mon Jan 30, 2012 02:47

I noticed that the mesecon registration at the bottom is commented out in the mesecon version. Was this intentional?
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

kahrl
Member
 
Posts: 236
Joined: Fri Sep 02, 2011 07:51
Location: Rös̓̇chenhof

by kahrl » Mon Jan 30, 2012 02:51

Do you think optional dependencies would be useful here? So this mod (hatches too) could have an optional dependency on mesecons, which would mean: make sure mesecons is loaded first, but only if it is loaded at all. Then check if mesecon ~= nil and only in that case register with it.
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Mon Jan 30, 2012 03:16

That sounds like a great idea - I'm in favor of it.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
Splizard
Member
 
Posts: 224
Joined: Wed Jan 25, 2012 07:20
Location: New Zealand
GitHub: Splizard
IRC: Splizard
In-game: Splizard

by Splizard » Mon Jan 30, 2012 03:16

Temperest wrote:I noticed that the mesecon registration at the bottom is commented out in the mesecon version. Was this intentional?


Whoops :D
Fixed now, please download gates 1.2 again.

kahrl wrote:Do you think optional dependencies would be useful here? So this mod (hatches too) could have an optional dependency on mesecons, which would mean: make sure mesecons is loaded first, but only if it is loaded at all. Then check if mesecon ~= nil and only in that case register with it.


Yes, it would be more efficient. It is anoying to create two different versions or for the user to manually edit the mod just for a few lines of code eg. gates or hatches + mesecons
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Tue Jan 31, 2012 04:00

Adding the following to line 88 gives proper tooltips in inventory views:

Code: Select all
description = "Gate",


I hope you'll consider including it.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
Splizard
Member
 
Posts: 224
Joined: Wed Jan 25, 2012 07:20
Location: New Zealand
GitHub: Splizard
IRC: Splizard
In-game: Splizard

by Splizard » Wed Feb 01, 2012 20:27

Updated to 1.3
Added inventory tooltips
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu Feb 02, 2012 17:54

Minetest Mod Spotlight - Gates 1.3
http://www.youtube.com/watch?v=uZHrin-7lqg
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
MirceaKitsune
Member
 
Posts: 837
Joined: Sat May 21, 2011 22:31
Location: Romania, Bucharest
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Mon Feb 13, 2012 16:34

+1. I wouldn't quite agree with doors opening in all directions for a default mod, but other than that I like this :)
 

Gatharoth
Member
 
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Wed Feb 15, 2012 08:45

Okay, so how exactly does the open gate look the way it does? Is it cause of plantlike drawtype? Or is it because of the visual scale? Or the combination of both? Or is it something else?? O.O
 

User avatar
Jordach
Member
 
Posts: 4518
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Wed Feb 15, 2012 11:21

When ounched the node def does change to plantlike, all he has done is remove part of the middle to appear like the gate is open. Nothing too hard here. Just a really clever trick.
viewtopic.php?f=10&t=19056 Solar Plains Dev Server
 

User avatar
lalorobot
Member
 
Posts: 32
Joined: Wed Feb 15, 2012 17:37
Location: Canada

by lalorobot » Thu Feb 16, 2012 00:38

It looks so great! but I cant craft it! maybe it is the way or where I put it? I made this: I went to the data folder and then made a folder in there called mods and in the mods folder I made another folder (XD) with the name gates-1.3 and tried crafting nothing....I left the init.lua script in the folder only and it did not worked! what I did wrong? help I am new with mods

I taked where and how to put mods from here: http://minetest.com/category/mods/
Last edited by lalorobot on Thu Feb 16, 2012 00:38, edited 1 time in total.
Mods make minetest even better and maybe getting better than minecraft with some time
my maps: http://c55.me/minetest/forum/viewtopic.php?id=1359
 

bob
Member
 
Posts: 66
Joined: Thu Feb 16, 2012 00:59

by bob » Thu Feb 16, 2012 01:04

nice your now my #1 mod make eveyone it is a very good mod with smart tricks in it
 

User avatar
Splizard
Member
 
Posts: 224
Joined: Wed Jan 25, 2012 07:20
Location: New Zealand
GitHub: Splizard
IRC: Splizard
In-game: Splizard

by Splizard » Thu Feb 16, 2012 01:07

It looks so great! but I cant craft it! maybe it is the way or where I put it? I made this: I went to the data folder and then made a folder in there called mods and in the mods folder I made another folder (XD) with the name gates-1.3 and tried crafting nothing....I left the init.lua script in the folder only and it did not worked! what I did wrong? help I am new with mods

I taked where and how to put mods from here: http://minetest.com/category/mods/


To install it copy the gates folder inside gates1.3 to your mods folder.
If you have the mesecons mod installed, copy the gates folder inside gates1.3/mesecons instead.
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

User avatar
lalorobot
Member
 
Posts: 32
Joined: Wed Feb 15, 2012 17:37
Location: Canada

by lalorobot » Fri Feb 17, 2012 20:15

Splizard wrote:
It looks so great! but I cant craft it! maybe it is the way or where I put it? I made this: I went to the data folder and then made a folder in there called mods and in the mods folder I made another folder (XD) with the name gates-1.3 and tried crafting nothing....I left the init.lua script in the folder only and it did not worked! what I did wrong? help I am new with mods

I taked where and how to put mods from here: http://minetest.com/category/mods/


To install it copy the gates folder inside gates1.3 to your mods folder.
If you have the mesecons mod installed, copy the gates folder inside gates1.3/mesecons instead.

Thanks! :D
Mods make minetest even better and maybe getting better than minecraft with some time
my maps: http://c55.me/minetest/forum/viewtopic.php?id=1359
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Tue Feb 28, 2012 23:09

Here's an update with iron doors, which only open with mesecon signals!

http://goo.gl/DiOfV

Useful in conjunction with the node ownership mod, which can prevent the placement of mesecons near the door to force it to open.

Also updated all the textures, so the gates should be more visible now.
Last edited by Temperest on Tue Feb 28, 2012 23:10, edited 1 time in total.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

Next

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 7 guests