Browse Source

teleporter deprecated, travelnet added

and added custom mod to convert teleporter, and changed forcefield range
from 20 to 30
master
poikilos 8 years ago
committed by Jacob Gustafson
parent
commit
cef718e155
  1. 11
      etc/Mods,WIP/teleporter_to_travelnet/README.txt
  2. 2
      etc/Mods,WIP/teleporter_to_travelnet/depends.txt
  3. 9
      etc/Mods,WIP/teleporter_to_travelnet/init.lua
  4. 56
      etc/change_world_name_manually_first/game-install-ENLIVEN
  5. 44
      etc/unused/unused-mods.sh
  6. 262
      games/ENLIVEN/mods/technic/machines/forcefield.lua

11
etc/Mods,WIP/teleporter_to_travelnet/README.txt

@ -0,0 +1,11 @@
Minetest Game mod: teleporter_to_travelnet
==========================================
This mod provides a transition from teleporter ( "Teleporter Mod" by Bad_Command_ https://forum.minetest.net/viewtopic.php?id=2149 ) so you can use Sokomine's "travelnet" mod instead.
Authors of source code
----------------------
expertmm (github.com/expertmm)
Authors of media (textures)
---------------------------
(no media)

2
etc/Mods,WIP/teleporter_to_travelnet/depends.txt

@ -0,0 +1,2 @@
default
travelnet

9
etc/Mods,WIP/teleporter_to_travelnet/init.lua

@ -0,0 +1,9 @@
-- Copyright 2017 expertmm (MIT license)
-- 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 copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- minetest.register_alias(name, convert_to)
-- "This means that if the engine finds nodes with the name name in the world the node with the name convert_to is used instead. "
-- <https://dev.minetest.net/minetest.register_alias>
minetest.register_alias("teleporter:teleport_pad", "travelnet:travelnet") -- travelnet box

56
etc/change_world_name_manually_first/game-install-ENLIVEN

@ -1691,54 +1691,36 @@ if [ ! -d "$MTMOD_DEST_PATH" ]; then
exit 1
fi
cd "$HOME/Downloads"
MTMOD_DL_ZIP=teleporter_badCommand_jkedit.zip
MTMOD_SRC_ZIP=teleporter.zip
MTMOD_UNZ_NAME=teleporter-master/teleporter
MTMOD_DEST_NAME=teleporter
#Sokomine's original version has no security ( https://forum.minetest.net/viewtopic.php?id=4877 )
cd $HOME/Downloads
MTMOD_DL_ZIP=master.zip
MTMOD_SRC_ZIP=travelnet.zip
MTMOD_UNZ_NAME=travelnet-master
MTMOD_DEST_NAME=travelnet
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
echo "Installing TenPlus1's (NOT Bad_Command_'s) teleporter <https://forum.minetest.net/viewtopic.php?f=11&t=2149>"
echo "Installing TenPlus1's (NOT Bad_Command_'s) teleporter <https://forum.minetest.net/viewtopic.php?f=11&t=2149>" >> $MTMOD_SRC_ZIP.txt
if [ -d "teleporter-master" ]; then
rm -Rf "teleporter-master"
fi
#if [ -d "$MTMOD_UNZ_NAME" ]; then
rm -Rf $MTMOD_UNZ_NAME
#fi
if [ -f $MTMOD_DL_ZIP ]; then
rm $MTMOD_DL_ZIP
rm -f $MTMOD_DL_ZIP
fi
if [ -f $MTMOD_SRC_ZIP ]; then
rm $MTMOD_SRC_ZIP
rm -f $MTMOD_SRC_ZIP
fi
#wget https://github.com/Bad-Command/teleporter/archive/master.zip
#TODO:
MTMOD_UNZ_NAME=teleporter
wget http://axlemedia.net/abiyahh/users/TenPlus1/downloads/teleporter_badCommand_jkedit.zip
mv $MTMOD_DL_ZIP $MTMOD_SRC_ZIP
unzip $MTMOD_SRC_ZIP
if [ -d "$MTMOD_DEST_PATH" ]; then
sudo rm -Rf "$MTMOD_DEST_PATH"
fi
wget https://github.com/Sokomine/travelnet/archive/master.zip
mv $MTMOD_DL_ZIP "$MTMOD_SRC_ZIP"
unzip "$MTMOD_SRC_ZIP"
sudo mv $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH"
if [ ! -d "$MTMOD_DEST_PATH" ]; then
echo "ERROR: failed to unzip $MTMOD_DEST_PATH, so cannot continue."
#exit 1
fi
rm -Rf teleporter-master
echo "teleport_perms_to_build = false" >> "$MT_MYWORLD_DIR/world.mt"
#When true, a player has to have the teleport permission to build a teleporter. When false, anyone can build a new teleporter.
echo "teleport_perms_to_configure = false" >> "$MT_MYWORLD_DIR/world.mt"
#When true, a player has to have the teleport permission to configure a teleporter. Players can still build teleporters without this, however the teleporter will be locked to the default location.
echo "teleport_requires_pairing = true" >> "$MT_MYWORLD_DIR/world.mt"
#When true, a teleporter can only be configured to teleport to a location near an existing teleporter. This prevents players from pointing teleporters in to unexplored terrain.
echo "teleport_pairing_check_radius = 2" >> "$MT_MYWORLD_DIR/world.mt"
#Specifies the size of the volume to scan when looking for a paired teleporter. Do not set this to a large value; the number of nodes scanned increases by a power of 3.
echo "teleport_default_coordinates = 0,0,0" >> "$MT_MYWORLD_DIR/world.mt"
#Allows for the default coordinates for new a teleporter to be specified. This is useful when players can build new teleporters, but can't configure them.
exit 1
fi
echo ""
echo ""

44
etc/unused/unused-mods.sh

@ -0,0 +1,44 @@
cd "$HOME/Downloads"
MTMOD_DL_ZIP=teleporter_badCommand_jkedit.zip
MTMOD_SRC_ZIP=teleporter.zip
MTMOD_UNZ_NAME=teleporter-master/teleporter
MTMOD_DEST_NAME=teleporter
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
echo "Installing TenPlus1's (NOT Bad_Command_'s) teleporter <https://forum.minetest.net/viewtopic.php?f=11&t=2149>"
echo "Installing TenPlus1's (NOT Bad_Command_'s) teleporter <https://forum.minetest.net/viewtopic.php?f=11&t=2149>" >> $MTMOD_SRC_ZIP.txt
if [ -d "teleporter-master" ]; then
rm -Rf "teleporter-master"
fi
#if [ -d "$MTMOD_UNZ_NAME" ]; then
rm -Rf $MTMOD_UNZ_NAME
#fi
if [ -f $MTMOD_DL_ZIP ]; then
rm $MTMOD_DL_ZIP
fi
if [ -f $MTMOD_SRC_ZIP ]; then
rm $MTMOD_SRC_ZIP
fi
#wget https://github.com/Bad-Command/teleporter/archive/master.zip
#TODO:
MTMOD_UNZ_NAME=teleporter
wget http://axlemedia.net/abiyahh/users/TenPlus1/downloads/teleporter_badCommand_jkedit.zip
mv $MTMOD_DL_ZIP $MTMOD_SRC_ZIP
unzip $MTMOD_SRC_ZIP
sudo mv $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH"
if [ ! -d "$MTMOD_DEST_PATH" ]; then
echo "ERROR: failed to unzip $MTMOD_DEST_PATH, so cannot continue."
#exit 1
fi
rm -Rf teleporter-master
echo "teleport_perms_to_build = false" >> "$MT_MYWORLD_DIR/world.mt"
#When true, a player has to have the teleport permission to build a teleporter. When false, anyone can build a new teleporter.
echo "teleport_perms_to_configure = false" >> "$MT_MYWORLD_DIR/world.mt"
#When true, a player has to have the teleport permission to configure a teleporter. Players can still build teleporters without this, however the teleporter will be locked to the default location.
echo "teleport_requires_pairing = true" >> "$MT_MYWORLD_DIR/world.mt"
#When true, a teleporter can only be configured to teleport to a location near an existing teleporter. This prevents players from pointing teleporters in to unexplored terrain.
echo "teleport_pairing_check_radius = 2" >> "$MT_MYWORLD_DIR/world.mt"
#Specifies the size of the volume to scan when looking for a paired teleporter. Do not set this to a large value; the number of nodes scanned increases by a power of 3.
echo "teleport_default_coordinates = 0,0,0" >> "$MT_MYWORLD_DIR/world.mt"
#Allows for the default coordinates for new a teleporter to be specified. This is useful when players can build new teleporters, but can't configure them.

262
games/ENLIVEN/mods/technic/machines/forcefield.lua

@ -0,0 +1,262 @@
--- Forcefield generator.
-- @author ShadowNinja
--
-- Forcefields are powerful barriers but they consume huge amounts of power.
-- The forcefield Generator is an HV machine.
-- How expensive is the generator?
-- Leaves room for upgrades lowering the power drain?
local forcefield_power_drain = 10
local S = technic.getter
minetest.register_craft({
output = "technic:forcefield_emitter_off",
recipe = {
{"default:mese", "technic:motor", "default:mese" },
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
{"default:mese", "technic:hv_cable", "default:mese" },
}
})
local replaceable_cids = {}
minetest.after(0, function()
for name, ndef in pairs(minetest.registered_nodes) do
if ndef.buildable_to == true and name ~= "ignore" then
replaceable_cids[minetest.get_content_id(name)] = true
end
end
end)
-- Idea: Let forcefields have different colors by upgrade slot.
-- Idea: Let forcefields add up by detecting if one hits another.
-- ___ __
-- / \/ \
-- | |
-- \___/\___/
local function update_forcefield(pos, meta, active, first)
local shape = meta:get_int("shape")
local range = meta:get_int("range")
local vm = VoxelManip()
local MinEdge, MaxEdge = vm:read_from_map(vector.subtract(pos, range),
vector.add(pos, range))
local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge})
local data = vm:get_data()
local c_air = minetest.get_content_id("air")
local c_field = minetest.get_content_id("technic:forcefield")
for z = -range, range do
for y = -range, range do
local vi = area:index(pos.x + (-range), pos.y + y, pos.z + z)
for x = -range, range do
local relevant
if shape == 0 then
local squared = x * x + y * y + z * z
relevant =
squared <= range * range + range and
squared >= (range - 1) * (range - 1) + (range - 1)
else
relevant =
x == -range or x == range or
y == -range or y == range or
z == -range or z == range
end
if relevant then
local cid = data[vi]
if active and replaceable_cids[cid] then
data[vi] = c_field
elseif not active and cid == c_field then
data[vi] = c_air
end
end
vi = vi + 1
end
end
end
vm:set_data(data)
vm:update_liquids()
vm:write_to_map()
-- update_map is very slow, but if we don't call it we'll
-- get phantom blocks on the client.
if not active or first then
vm:update_map()
end
end
local function set_forcefield_formspec(meta)
local formspec = "size[5,2.25]"..
"field[0.3,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]"
-- The names for these toggle buttons are explicit about which
-- state they'll switch to, so that multiple presses (arising
-- from the ambiguity between lag and a missed press) only make
-- the single change that the user expects.
if meta:get_int("shape") == 0 then
formspec = formspec.."button[3,0.2;2,1;shape1;"..S("Sphere").."]"
else
formspec = formspec.."button[3,0.2;2,1;shape0;"..S("Cube").."]"
end
if meta:get_int("mesecon_mode") == 0 then
formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]"
else
formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
end
if meta:get_int("enabled") == 0 then
formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
else
formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
end
meta:set_string("formspec", formspec)
end
local forcefield_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local range = nil
if fields.range then
range = tonumber(fields.range) or 0
-- Smallest field is 5. Anything less is asking for trouble.
-- Largest is 20. It is a matter of pratical node handling.
-- At the maximim range updating the forcefield takes about 0.2s
range = math.max(range, 5)
range = math.min(range, 30)
if range == meta:get_int("range") then range = nil end
end
if fields.shape0 or fields.shape1 or range then
update_forcefield(pos, meta, false)
end
if range then meta:set_int("range", range) end
if fields.shape0 then meta:set_int("shape", 0) end
if fields.shape1 then meta:set_int("shape", 1) end
if fields.enable then meta:set_int("enabled", 1) end
if fields.disable then meta:set_int("enabled", 0) end
if fields.mesecon_mode_0 then meta:set_int("mesecon_mode", 0) end
if fields.mesecon_mode_1 then meta:set_int("mesecon_mode", 1) end
set_forcefield_formspec(meta)
end
local mesecons = {
effector = {
action_on = function(pos, node)
minetest.get_meta(pos):set_int("mesecon_effect", 1)
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_int("mesecon_effect", 0)
end
}
}
local function run(pos, node)
local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("HV_EU_input")
local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
local machine_name = S("%s Forcefield Emitter"):format("HV")
local range = meta:get_int("range")
local power_requirement
if meta:get_int("shape") == 0 then
power_requirement = math.floor(4 * math.pi * range * range)
else
power_requirement = 24 * range * range
end
power_requirement = power_requirement * forcefield_power_drain
if not enabled then
if node.name == "technic:forcefield_emitter_on" then
update_forcefield(pos, meta, false)
technic.swap_node(pos, "technic:forcefield_emitter_off")
meta:set_string("infotext", S("%s Disabled"):format(machine_name))
end
meta:set_int("HV_EU_demand", 0)
return
end
meta:set_int("HV_EU_demand", power_requirement)
if eu_input < power_requirement then
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
if node.name == "technic:forcefield_emitter_on" then
update_forcefield(pos, meta, false)
technic.swap_node(pos, "technic:forcefield_emitter_off")
end
elseif eu_input >= power_requirement then
local first = false
if node.name == "technic:forcefield_emitter_off" then
first = true
technic.swap_node(pos, "technic:forcefield_emitter_on")
meta:set_string("infotext", S("%s Active"):format(machine_name))
end
update_forcefield(pos, meta, true, first)
end
end
minetest.register_node("technic:forcefield_emitter_off", {
description = S("%s Forcefield Emitter"):format("HV"),
tiles = {"technic_forcefield_emitter_off.png"},
groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
on_receive_fields = forcefield_receive_fields,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("HV_EU_input", 0)
meta:set_int("HV_EU_demand", 0)
meta:set_int("range", 10)
meta:set_int("enabled", 0)
meta:set_int("mesecon_mode", 0)
meta:set_int("mesecon_effect", 0)
meta:set_string("infotext", S("%s Forcefield Emitter"):format("HV"))
set_forcefield_formspec(meta)
end,
mesecons = mesecons,
technic_run = run,
})
minetest.register_node("technic:forcefield_emitter_on", {
description = S("%s Forcefield Emitter"):format("HV"),
tiles = {"technic_forcefield_emitter_on.png"},
groups = {cracky = 1, technic_machine = 1, technic_hv = 1,
not_in_creative_inventory=1},
drop = "technic:forcefield_emitter_off",
on_receive_fields = forcefield_receive_fields,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)
update_forcefield(pos, meta, false)
end,
mesecons = mesecons,
technic_run = run,
technic_on_disable = function (pos, node)
local meta = minetest.get_meta(pos)
update_forcefield(pos, meta, false)
technic.swap_node(pos, "technic:forcefield_emitter_off")
end,
})
minetest.register_node("technic:forcefield", {
description = S("%s Forcefield"):format("HV"),
sunlight_propagates = true,
drawtype = "glasslike",
groups = {not_in_creative_inventory=1},
paramtype = "light",
light_source = 15,
diggable = false,
drop = '',
tiles = {{
name = "technic_forcefield_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.0,
},
}},
})
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("technic:forcefield")
end
technic.register_machine("HV", "technic:forcefield_emitter_on", technic.receiver)
technic.register_machine("HV", "technic:forcefield_emitter_off", technic.receiver)
Loading…
Cancel
Save