Page 1 of 2

Simple doors mod

PostPosted: Fri Dec 16, 2011 18:59
by randomproof
This is a proof of concept doors mod.

March 2012 (Updated for new code changes)
Jan 2012 (Updated for new code changes)


License: Public Domain

Gitorious Link:
https://gitorious.org/randomproofs-minetest-mods/doors/trees/master

Adds two new nodes, "door_wood" and "doorhandle_wood". You make a door by adding regular door pieces and adding the handle node at the edge of the door. Make sure the handle node is only touching one regular door node horizontally or it will not be able to find the right pivot point. Also, make sure there are empty nodes where the door will move to or it will not move. To open or close punch the handle with your hand. Minimum door width is 2 and no maximum. There can be a short lag between when the door moves and the updated nodes are sent to the client. Door should open away from you.

How to make door pieces:
Image

How to make doorhandle pieces:
Image

Here is a door:
Image

Opened inward:
Image

View of opened door from inside:
Image

Closed door from inside:
Image

Door opened outward
Image

PostPosted: Fri Dec 16, 2011 19:22
by MarkTraceur
Awesome! It's still a little buggy (a 2x3 door for me doesn't move the block above the handle), but very good. Do you think you can make it look slimmer with the signlike drawtype?

PostPosted: Fri Dec 16, 2011 19:25
by MarkTraceur
Also, your crafting recipe shouldn't use steel_ingot as a node, it's a craft item :)

PostPosted: Fri Dec 16, 2011 20:04
by randomproof
MarkTraceur wrote:Also, your crafting recipe shouldn't use steel_ingot as a node, it's a craft item :)

Yea, I saw that and fixed it.

MarkTraceur wrote:Awesome! It's still a little buggy (a 2x3 door for me doesn't move the block above the handle), but very good. Do you think you can make it look slimmer with the signlike drawtype?

I did this kinda quick and it is not the best it could be. I was thinking of using a different drawtype but I just wanted to get it working before I started worrying about how it looks. I'll need to see a picture of the door that isn't working, because I've tried different sizes and shapes (they need not be rectangular, but handle must be at farthest point from pivot point and placed last).

PostPosted: Fri Dec 16, 2011 22:00
by MarkTraceur
randomproof wrote:placed last


That's my problem. Thanks.

PostPosted: Fri Dec 16, 2011 22:57
by randomproof
MarkTraceur wrote:
randomproof wrote:placed last


That's my problem. Thanks.


When you place the door handle it finds all the regular door pieces and calculates the 2 possible open positions. That is why it must be placed last. It may be possible to calculate the open position dynamically. I did it the way I did so as t save the beginning position, without that it could go all the way around. Now that I think about it, I need to add a check to make sure the moving door doesn't clobber pre-existing blocks.

PostPosted: Sat Dec 17, 2011 02:58
by darket
actually how to remove them ??????

PostPosted: Sat Dec 17, 2011 06:18
by MasterZEN91
My homie has you mod on his server, very nice i might add, but the texture is so i uno, not right. Not to be a arse but can we use a texture i made till we get yours?

links are:
Knob:http://tinypic.com/view.php?pic=ic8cqh&s=5
No knob:http://tinypic.com/view.php?pic=2igj1w3&s=5
There small and just under where it says TAGS: click to add tags

Zen

PostPosted: Sat Dec 17, 2011 16:30
by randomproof
MasterZEN91 wrote:My homie has you mod on his server, very nice i might add, but the texture is so i uno, not right. Not to be a arse but can we use a texture i made till we get yours?

links are:
Knob:http://tinypic.com/view.php?pic=ic8cqh&s=5
No knob:http://tinypic.com/view.php?pic=2igj1w3&s=5
There small and just under where it says TAGS: click to add tags

Zen


Feel free to do whatever you want with this code. I made the textures really quick so as to be very obvious.

PostPosted: Sat Dec 17, 2011 16:32
by randomproof
darket wrote:actually how to remove them ??????

You can remove with a tool, like an axe. I tried to make the handle only respond to being hit with an empty hand.

PostPosted: Sat Dec 17, 2011 22:49
by lordawe
This is COOL mod. I've already implemeted it. But it destroys blocks nearby as you mention it and also, if i destroy door blocks and touch the knob with anything but axe - voila! - door opens with full blocks so I can "clone" door blocks without the knob easily... this should be fixed.

I would destroy the door in reverse order. To remove it you should destroy the knob first, otherwise the door would be unbreakable...

Is it possible to make signs open with door when placed? it would be even cooler!
Thank you for this mod!

PostPosted: Sun Dec 18, 2011 18:42
by randomproof
lordawe wrote:... But it destroys blocks nearby as you mention it and also, if i destroy door blocks and touch the knob with anything but axe - voila! - door opens with full blocks so I can "clone" door blocks without the knob easily... this should be fixed.

I would destroy the door in reverse order. To remove it you should destroy the knob first, otherwise the door would be unbreakable...

Is it possible to make signs open with door when placed? it would be even cooler!
Thank you for this mod!

Good ideas. I've been thinking of having it work a little differently so I will look into these issues in the next few days.

PostPosted: Tue Dec 20, 2011 20:24
by randomproof
Version 2 is up on Gitorious. It is almost a complete rewrite. Eveerything is calculated when the handle is hit, so the handle doesn't have to be placed last and you can change the shape of the door without causing problems. The next update will include more door types.

NOTE: If you used the old version you will have to reset all the old doors. If they are in the closed position already you just need to remove and replace the handle pieces.

PostPosted: Wed Dec 21, 2011 00:02
by RAPHAEL
randomproof wrote:Version 2 is up on Gitorious. It is almost a complete rewrite. Eveerything is calculated when the handle is hit, so the handle doesn't have to be placed last and you can change the shape of the door without causing problems. The next update will include more door types.

NOTE: If you used the old version you will have to reset all the old doors. If they are in the closed position already you just need to remove and replace the handle pieces.

Doesn't seem to load.

This is what the debug says with doors mod in the mods folder. With it outside Minetest loads:
18:27:32: ERROR[main]: Some exception, what()="LuaError: Stack is over 30 (reality check)
18:27:32: ERROR[main]: stack traceback:"
18:27:32: ERROR[main]: error_message = Some exception, what()="LuaError: Stack is over 30 (reality check)


minetest-0.4.dev-20111209-1-win32

PostPosted: Wed Dec 21, 2011 01:34
by randomproof
RAPHAEL wrote:
randomproof wrote:Version 2 is up on Gitorious. It is almost a complete rewrite. Eveerything is calculated when the handle is hit, so the handle doesn't have to be placed last and you can change the shape of the door without causing problems. The next update will include more door types.

NOTE: If you used the old version you will have to reset all the old doors. If they are in the closed position already you just need to remove and replace the handle pieces.

Doesn't seem to load.

This is what the debug says with doors mod in the mods folder. With it outside Minetest loads:
18:27:32: ERROR[main]: Some exception, what()="LuaError: Stack is over 30 (reality check)
18:27:32: ERROR[main]: stack traceback:"
18:27:32: ERROR[main]: error_message = Some exception, what()="LuaError: Stack is over 30 (reality check)


minetest-0.4.dev-20111209-1-win32


I wonder if you could put the whole debug.txt from when you try to load it. I can't think of were this error is coming from unless it is because you have a lot of mods running at once.

PostPosted: Wed Dec 21, 2011 15:46
by RAPHAEL
randomproof wrote:I wonder if you could put the whole debug.txt from when you try to load it. I can't think of were this error is coming from unless it is because you have a lot of mods running at once.

http://minetest.weareonesoul.com/debug.txt

PostPosted: Wed Dec 21, 2011 18:07
by mcburgerbob
cool mod! Minetest really needs doors.

PostPosted: Wed Dec 21, 2011 20:16
by randomproof
RAPHAEL wrote:
randomproof wrote:I wonder if you could put the whole debug.txt from when you try to load it. I can't think of were this error is coming from unless it is because you have a lot of mods running at once.

http://minetest.weareonesoul.com/debug.txt


Looking at were it crashed (scriptapi.cpp line 85 from line 2716) it looks like you may have a lot of mods running and I think that is causing the lua stack to overflow. I'm not sure if you are building from source but try upping the numbers in the realitycheck() function and anywhere you see "assert(lua_checkstack(L, 20));" in the scriptapi.cpp function and see if that fixes the problem.

Funny thing that the code sets the stack size to at least 20 (which is the default in the lua code) but errors where it is over 30.

PostPosted: Thu Dec 22, 2011 04:03
by Gatharoth
Won't load up for me. There is an error with the lua file.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
19:57:51: INFO[main]: Server: Loading mod "randomproofs_minetest_mods_doors"
19:57:51: INFO[main]: Loading and running script from C:\Users\###\Desktop\minetest-0.4.dev-20111209-1-win32\bin\..\data\mods\randomproofs_minetest_mods_doors\init.lua
19:57:51: ERROR[main]: Error loading mod "randomproofs_minetest_mods_doors": LuaError: Name "doors:door_wood" does not follow naming conventions: "modname:" or ":" prefix required)
19:57:51: ERROR[main]: stack traceback:
19:57:51: ERROR[main]:     [C]: in function 'register_node'
19:57:51: ERROR[main]:     ...\data\mods\randomproofs_minetest_mods_doors\init.lua:1: in main chunk
19:57:51: ERROR[main]: Server: Failed to load and run C:\Users\###\Desktop\minetest-0.4.dev-20111209-1-win32\bin\..\data\mods\randomproofs_minetest_mods_doors\init.lua
BanManager: saving to C:\Users\###\Desktop\minetest-0.4.dev-20111209-1-win32\bin\..\world\ipban.txt
AuthManager: saving to C:\Users\###\Desktop\minetest-0.4.dev-20111209-1-win32\bin\..\world\auth.txt
19:57:51: ERROR[main]: ModError: Failed to load and run C:\Users\###\Desktop\minetest-0.4.dev-20111209-1-win32\bin\..\data\mods\randomproofs_minetest_mods_doors\init.lua
19:57:51: ERROR[main]: error_message = ModError: Failed to load and run C:\Users\###\Desktop\minetest-0.4.dev-20111209-1-win32\bin\..\data\mods\randomproofs_minetest_mods_doors\init.lua
19:57:51: ERROR[main]: Check debug.txt for details.
19:57:51: INFO[main]: Created main menu


There is no other additional mods running than what was already in the 0.4dev.
Nor is there any other errors in the debug logfile.

PostPosted: Thu Dec 22, 2011 15:41
by randomproof
Gatharoth wrote:Won't load up for me. There is an error with the lua file.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
19:57:51: ERROR[main]: Error loading mod "randomproofs_minetest_mods_doors": LuaError: Name "doors:door_wood" does not follow naming conventions: "modname:" or ":" prefix required)


There is no other additional mods running than what was already in the 0.4dev.
Nor is there any other errors in the debug logfile.

Your error is because you changed the name of the mod's directory but not the prefix on the nodes. Just replace "doors:" with "randomproofs_minetest_mods_doors:"

PostPosted: Thu Dec 22, 2011 16:50
by Gatharoth
randomproof wrote:
Gatharoth wrote:Won't load up for me. There is an error with the lua file.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
19:57:51: ERROR[main]: Error loading mod "randomproofs_minetest_mods_doors": LuaError: Name "doors:door_wood" does not follow naming conventions: "modname:" or ":" prefix required)


There is no other additional mods running than what was already in the 0.4dev.
Nor is there any other errors in the debug logfile.

Your error is because you changed the name of the mod's directory but not the prefix on the nodes. Just replace "doors:" with "randomproofs_minetest_mods_doors:"


Okay Thanks :D. Anyway, when you download it (not clone it) it gets names "randomproofs_minetest_mods_doors". Just a FYI.

PostPosted: Thu Dec 22, 2011 18:43
by randomproof
Gatharoth wrote:Okay Thanks :D. Anyway, when you download it (not clone it) it gets names "randomproofs_minetest_mods_doors". Just a FYI.

Thanks, good to know.

PostPosted: Fri Dec 23, 2011 02:19
by MrThebuilder3
how do you use the gates?

PostPosted: Fri Dec 23, 2011 15:15
by randomproof
MrThebuilder3 wrote:how do you use the gates?

Same as if they were door pieces. I've changed the inventory textures a little to make it easier to tell the gate from the gate handle nodes. I'm not good at textures and fence pieces are wrapped around the shape in a funny way.

Maybe after the holiday I will see if I can put together a video demoing the door pieces.

PostPosted: Fri Dec 23, 2011 16:20
by MrThebuilder3
i ment crafting...

PostPosted: Fri Dec 23, 2011 17:24
by Gatharoth
MrThebuilder3 wrote:i ment crafting...


Normal: wood, wood, steel ingot
wood, wood, steel ingot

Handle: steel ignot, wood, steel ingot
wood, wood, wood

Note: this is in order from left to right and top from down in the craft menu.

PostPosted: Fri Dec 23, 2011 17:27
by MrThebuilder3
the gate not the door but nevermind

PostPosted: Fri Dec 23, 2011 18:15
by dannydark
You do know you could have just looked in the lua file?

Gate:
Stick, Stick, Steel Ingot,
Stick, Stick, Steel Ingot

Handle:
Stick, Steel Ingot, Stick,
Stick, Stick, Stick

PostPosted: Sat Jan 07, 2012 08:19
by sycam
can you please send my this mod because i can't get an account my email address is <censored>

(to anyone who has this mod)

PostPosted: Sat Jan 07, 2012 09:20
by sfan5
sycam wrote:can you please send my this mod because i can't get an account my email address is <censored>

(to anyone who has this mod)

You must not create an Gitorious Account, use this Link