Page 1 of 1

[Mod] Computer (now can be turned on/off!) [computer](V1) [comp](V2)

PostPosted: Mon Apr 01, 2013 23:30
by 12Me21
This mod adds a computer to minetest that can be turned on/off by punching.

Screenshots: maybe coming soon

Dependencies: none

Crafting: none

Download:
Version 2 (punch it to turn it on or off) http://ompldr.org/vaHphcg/comp.zip
Version 1http://ompldr.org/vaHluZA/computer.zip

PostPosted: Tue Apr 02, 2013 01:08
by kaeza
Cool! Can I add that to my mod?
http://forum.minetest.net/viewtopic.php?id=3830

Of course, I will put your name on the credits :)

PostPosted: Tue Apr 02, 2013 02:11
by 12Me21
sure!

PostPosted: Tue Apr 02, 2013 03:01
by kaeza
12Me21 wrote:sure!

Thanks! As for a way to make them turn on/off, it would be somewhat like the code to open/close the toilets in homedecor.
https://github.com/VanessaE/homedecor/blob/master/furniture_bathroom.lua

PostPosted: Tue Apr 02, 2013 03:51
by jojoa1997
Could you post screenies

PostPosted: Tue Apr 02, 2013 10:47
by 12Me21
kaeza wrote:
12Me21 wrote:sure!

Thanks! As for a way to make them turn on/off, it would be somewhat like the code to open/close the toilets in homedecor.
https://github.com/VanessaE/homedecor/blob/master/furniture_bathroom.lua

I tried that, but I couldn't get it to work, if you can, then add it.

PostPosted: Tue Apr 02, 2013 15:35
by 12Me21
Try adding this to the code,
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
minetest.register_on_punchnode = function (pos, node, puncher)
    if node.name == 'computer:comp1_on' then
        local dir = node["param2"]
        minetest.env:add_node(pos, {name="computer:comp1_off", paramtype2='none', param2=dir})
        nodeupdate(pos)
    elseif node.name == 'computer:comp1_off' then
        local dir = node["param2"]
        minetest.env:add_node(pos, {name="computer:comp1_on", paramtype2='none', param2=dir})
        nodeupdate(pos)
    end
end


It probably won't work, because I can't test it.

PostPosted: Tue Apr 02, 2013 16:06
by kaeza
12Me21 wrote:Try adding this to the code,
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
minetest.register_on_punchnode = function (pos, node, puncher)
    if node.name == 'computer:comp1_on' then
        local dir = node["param2"]
        minetest.env:add_node(pos, {name="computer:comp1_off", paramtype2='none', param2=dir})
        nodeupdate(pos)
    elseif node.name == 'computer:comp1_off' then
        local dir = node["param2"]
        minetest.env:add_node(pos, {name="computer:comp1_on", paramtype2='none', param2=dir})
        nodeupdate(pos)
    end
end


It probably won't work, because I can't test it.

Already done in my mod (I still didn't add your towers, but will do soon). Look here for turn on/off: https://github.com/kaeza/minetest-computer/blob/master/init.lua#L32

PostPosted: Tue Apr 02, 2013 19:20
by 12Me21
kaeza wrote:
12Me21 wrote:Try adding this to the code,
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
minetest.register_on_punchnode = function (pos, node, puncher)
    if node.name == 'computer:comp1_on' then
        local dir = node["param2"]
        minetest.env:add_node(pos, {name="computer:comp1_off", paramtype2='none', param2=dir})
        nodeupdate(pos)
    elseif node.name == 'computer:comp1_off' then
        local dir = node["param2"]
        minetest.env:add_node(pos, {name="computer:comp1_on", paramtype2='none', param2=dir})
        nodeupdate(pos)
    end
end


It probably won't work, because I can't test it.

Already done in my mod (I still didn't add your towers, but will do soon). Look here for turn on/off: https://github.com/kaeza/minetest-computer/blob/master/init.lua#L32


Can you make it so there are no abbreviations or what ever in the code? because I don't understand all the TEXPFX.."ft.png",
and
local ONSTATE = modname..":"..basename;
stuff

PostPosted: Wed Apr 10, 2013 12:08
by Mihobre
use some other website than omploader pls. omploader doesnt work on my computer. pls pls pls. pm me if you did