Compare commits
5 Commits
629482e525
...
4c22387816
Author | SHA1 | Date |
---|---|---|
Emojigit | 4c22387816 | |
Emojigit | 16dc7a29c4 | |
Emojigit | 319b7dd484 | |
Emojigit | c77b42d6b3 | |
Emojigit | ded540d6f8 |
2
LICENSE
2
LICENSE
|
@ -1,5 +1,5 @@
|
|||
MIT License
|
||||
Copyright (c) 2016 Elijah Duffy
|
||||
Copyright (c) 2016 Elijah Duffy and Cato Yiu
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
|
|
|
@ -15,7 +15,7 @@ digicompute.register_computer("<computer_string>", {
|
|||
})
|
||||
```
|
||||
|
||||
The definition is formed just like that of a normal node definition, except digicompute uses it to do a lot of groundwork rather than requiring you to do it manually. **Note:** do not put a modname in the computer string, `digicompute:` is automatically inserted.
|
||||
The definition is formed just like that of a normal node definition, except digicompute uses it to do a lot of groundwork rather than requiring you to do it manually. **Note:** do not put a modname in the computer string, `digicompute_redo:` is automatically inserted.
|
||||
|
||||
**Example:**
|
||||
```lua
|
||||
|
|
|
@ -25,7 +25,7 @@ local check_booting = coroutine.create(function()
|
|||
local temp = get_node(c.pos)
|
||||
local ddef = minetest.registered_nodes[temp.name].digicompute
|
||||
if ddef.state == "off" or ddef.state == "bios" then
|
||||
local name, param2 = "digicompute:"..ddef.base, temp.param2
|
||||
local name, param2 = "digicompute_redo:"..ddef.base, temp.param2
|
||||
digicompute.c:complete_boot(c.pos, id, name, param2)
|
||||
else
|
||||
c.booting = nil
|
||||
|
@ -158,7 +158,7 @@ end
|
|||
-- [function] turn computer off
|
||||
function digicompute.c:off(pos, player)
|
||||
local temp = minetest.get_node(pos) -- Get basic node information
|
||||
local offname = "digicompute:"..minetest.registered_nodes[temp.name].digicompute.base
|
||||
local offname = "digicompute_redo:"..minetest.registered_nodes[temp.name].digicompute.base
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- Swap node to off
|
||||
minetest.swap_node({x = pos.x, y = pos.y, z = pos.z}, {name = offname, param2 = temp.param2})
|
||||
|
@ -190,7 +190,7 @@ end
|
|||
|
||||
function digicompute.register_computer(itemstring, def)
|
||||
-- off
|
||||
minetest.register_node("digicompute:"..itemstring, {
|
||||
minetest.register_node("digicompute_redo:"..itemstring, {
|
||||
digicompute = {
|
||||
state = "off",
|
||||
base = itemstring,
|
||||
|
@ -201,7 +201,7 @@ function digicompute.register_computer(itemstring, def)
|
|||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
drop = "digicompute:"..itemstring,
|
||||
drop = "digicompute_redo:"..itemstring,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
node_box = def.node_box,
|
||||
after_place_node = function(pos, player)
|
||||
|
@ -230,7 +230,7 @@ function digicompute.register_computer(itemstring, def)
|
|||
end,
|
||||
})
|
||||
-- bios
|
||||
minetest.register_node("digicompute:"..itemstring.."_bios", {
|
||||
minetest.register_node("digicompute_redo:"..itemstring.."_bios", {
|
||||
light_source = def.light_source or 7,
|
||||
digicompute = {
|
||||
state = "bios",
|
||||
|
@ -242,7 +242,7 @@ function digicompute.register_computer(itemstring, def)
|
|||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2, not_in_creative_inventory = 1},
|
||||
drop = "digicompute:"..itemstring,
|
||||
drop = "digicompute_redo:"..itemstring,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
node_box = def.node_box,
|
||||
on_destruct = function(pos)
|
||||
|
@ -252,7 +252,7 @@ function digicompute.register_computer(itemstring, def)
|
|||
end,
|
||||
})
|
||||
-- on
|
||||
minetest.register_node("digicompute:"..itemstring.."_on", {
|
||||
minetest.register_node("digicompute_redo:"..itemstring.."_on", {
|
||||
light_source = def.light_source or 7,
|
||||
digicompute = {
|
||||
state = "on",
|
||||
|
@ -264,7 +264,7 @@ function digicompute.register_computer(itemstring, def)
|
|||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2, not_in_creative_inventory = 1},
|
||||
drop = "digicompute:"..itemstring,
|
||||
drop = "digicompute_redo:"..itemstring,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
node_box = def.node_box,
|
||||
on_rightclick = function(pos, node, player)
|
||||
|
|
|
@ -282,7 +282,7 @@ function digicompute.c:open(pos, player, formname)
|
|||
digicompute.c:set_user(pos, name)
|
||||
|
||||
computer_contexts[name] = minetest.get_meta(pos):get_string("id")
|
||||
minetest.show_formspec(name, "digicompute:"..formname, form.get(pos, player))
|
||||
minetest.show_formspec(name, "digicompute_redo:"..formname, form.get(pos, player))
|
||||
return true
|
||||
end
|
||||
else
|
||||
|
|
|
@ -34,7 +34,7 @@ function digicompute.c:set_user(pos, name)
|
|||
local formname = meta:get_string("formname")
|
||||
-- if formname is defined, close that formspec
|
||||
if formname ~= "" then
|
||||
minetest.close_formspec(current_user, "digicompute:"..formname)
|
||||
minetest.close_formspec(current_user, "digicompute_redo:"..formname)
|
||||
end
|
||||
-- Remove from current users
|
||||
current_users[current_user] = nil
|
||||
|
@ -56,7 +56,7 @@ function digicompute.c:unset_user(pos, name)
|
|||
local formname = meta:get_string("formname")
|
||||
-- if formname is defined, close that formspec
|
||||
if formname ~= "" then
|
||||
minetest.close_formspec(name, "digicompute:"..formname)
|
||||
minetest.close_formspec(name, "digicompute_redo:"..formname)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue