Compare commits

..

13 Commits
v1 ... master

Author SHA1 Message Date
sys4-fr
b5586a0109 Fix elevator sound assignment 2018-03-26 20:44:08 +02:00
jimy-byerley
5b67f8556f fixed error in marks detections 2018-03-25 20:49:21 +02:00
jimy-byerley
f591030bb5 some details corrected 2018-03-24 10:35:59 +01:00
jimy-byerley
37e8a1d861 change sounds, fixed problem to dig it in admin mode 2018-03-24 10:07:01 +01:00
jimy-byerley
9ce4e8034f syntax corrections 2018-03-24 09:34:09 +01:00
jimy-byerley
a5e0463827 node group mecanic renamed to mechanic 2018-03-24 09:28:48 +01:00
jimy-byerley
28d653b3b7 documatation and craft updated 2018-03-24 09:22:18 +01:00
jimy-byerley
763ab5b6a3 documatation and craft updated 2018-03-24 09:19:06 +01:00
jimy-byerley
5b709f1e10 release v2 2018-03-23 19:07:09 +01:00
jimy byerley
2b6a88f138
no more needed 2018-03-23 19:04:21 +01:00
jimy byerley
f2cd08ddc1
no more needed 2018-03-23 19:04:11 +01:00
jimy byerley
9b631b95fc
no more needed 2018-03-23 19:04:01 +01:00
jimy byerley
87ae80bf5c
v2 release 2018-03-23 19:02:45 +01:00
140 changed files with 13404 additions and 26050 deletions

View File

@ -1,14 +1,24 @@
minetest-technology minetest-technology
=================== ===================
A minetest mod which provide some hi-tech stuff : flat screen, bronze structures, concrete, ... A minetest mod which provide some hi-tech stuff : flat screen, elevators, aircrafts, overall plans, bronze structures, concrete, ...
![bronzee structures](https://forum.minetest.net/download/file.php?id=14493)
![patroller](https://forum.minetest.net/download/file.php?id=14495)
Install Install
======= =======
As other minetest mod : extract the zip file as "technology" in the games/minetest_game/mods directory. As other minetest mod : extract the zip file as `"technology"` in the `games/minetest_game/mods directory` or in `mods` directory.
Other Other
===== =====
See documentation.txt to learn more (about crafting for exemple). See `documentation.txt` to learn more (about crafting for exemple).
Copyright
=========
author: jimy byerley (jimy.byerley@gmail.com)
All the source code, models, textures, sounds are under Creative Common Share Alike, except the following files:
`sounds/elevator_close.wav` by joedeshon (freesound.org)
`sounds/elevator_loop.wav` by marcel_farres (freesound.org)

View File

@ -1,21 +1,5 @@
local function get_sign(i)
if i == 0 then
return 0
else
return i/math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = math.cos(yaw)*v
local z = math.sin(yaw)*v
return {x=x, y=y, z=z}
end
local function get_v(v)
return math.sqrt(v.x^2+v.z^2)
end
--[[ --[[
minetest.register_abm({ minetest.register_abm({
nodenames = {"air"}, nodenames = {"air"},
@ -27,143 +11,269 @@ minetest.register_abm({
}) })
]] ]]
local hunter = {
hp_max = 100, --[[
Exportation des animations depuis blender:
il faut avoir la config suivante:
+ export normals
+ flip normals
+ export UV coords
+ export skin weight
- apply modifier
+ export armature bones
+ export rest animation
+ export animations
+ include frame rate
]]
local patroller = {
hp_max = 400,
physical = true, physical = true,
collisionbox = {-2.5,-7,-2.5, 2.5,4,2.5}, collisionbox = {-2.5,-7,-2.5, 2.5,4,2.5},
visual = "mesh", visual = "mesh",
mesh = "patrouilleur.x", mesh = "patroller.x",
textures = {"patrouilleur.png"}, textures = {"technology_patroller.png"},
automatic_rotate = true, --automatic_rotate = true,
makes_footstep_sound = true, --makes_footstep_sound = true,
spritediv = {x=1, y=1}, --spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0}, --initial_sprite_basepos = {x=0, y=0},
is_visible = true, --is_visible = true,
can_punch = true,
driver = nil, driver = nil,
v = 0, front_vel_target = 0, -- 0 is no speed, 1 is maximum speed
z = 0, vert_vel_target = 0,
max_front_vel = 10,
max_vert_vel = 7,
} }
function hunter:on_rightclick(clicker) local FPS = 15 -- frame per second for animations
local WEAPONS = minetest.get_modpath("firearms_guns") or false -- auto enable weapon support
function patroller:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
if self.driver and puncher == self.driver then
self:fire(self.driver:get_look_dir())
end
--[[
self.object:remove()
if puncher and puncher:is_player() then
puncher:get_inventory():add_item("main", "technology:patroller")
end
]]
end
function patroller:fire(direction)
if WEAPONS then
local p = self.object:getpos()
p.y = p.y-7
firearmslib.fire("technology:air_canon", p, direction)
end
end
if WEAPONS then
--[[
firearmslib.register_bullet("technology:air_canon_ammo", {
description = "5mm air canon amunition";
inventory_image = "firearms_bullet_556.png";
damage = 12;
power = 5;
gravity = 0;
});
firearmslib.register_firearm("technology:air_canon", {
description = "5mm air canon";
inventory_image = "firearms_m4.png";
bullets = "technology:air_canon_ammo";
clip_size = 42;
spread = 0.035;
burst = 3;
burst_interval = 0.15;
wield_scale = {x=2,y=2,z=2};
crosshair_image = "firearms_crosshair_rifle.png";
hud_image = "firearms_m4_hud.png";
sounds = {
shoot = "firearms_m4_shot";
empty = "firearms_default_empty";
reload = "firearms_rifle_reload";
};
});
]]
firearmslib.register_bullet("technology:air_canon_ammo", {
description = "Rocket";
inventory_image = "firearms_rocket.png";
texture = "firearms_rocket_entity.png";
damage = 10;
power = 5;
speed = 25;
gravity = 0;
explosion_range = 2.5;
explosion_damage = 6;
leaves_smoke = true;
on_destroy = firearmslib.on_destroy_explode;
});
firearmslib.register_firearm("technology:air_canon", {
description = "Bazooka";
inventory_image = "firearms_bazooka.png";
bullets = "technology:air_canon_ammo";
clip_size = 5;
spread = 0.035;
wield_scale = {x=3,y=3,z=3};
crosshair_image = "firearms_crosshair_rlauncher.png";
hud_image = "firearms_bazooka_hud.png";
sounds = {
shoot = "firearms_m79_shot"; -- TODO: Find a better sound
empty = "firearms_default_empty";
--reload = "firearms_default_reload";
};
});
end
function patroller:on_rightclick(clicker)
if not clicker or not clicker:is_player() then if not clicker or not clicker:is_player() then
return return
end end
if self.driver and clicker == self.driver then if self.driver and clicker == self.driver then
self.driver = nil self.driver = nil
self.object:set_animation({x=50, y=55}, 15, 1) self.object:set_animation({x=54, y=54}, FPS, 0)
local p = get_velocity(3, self.object:getyaw(), 3)
local pos = self.object:getpos() local pos = self.object:getpos()
pos.x = pos.x-p.x local yaw = self.object:getyaw()
pos.y = pos.y-p.y pos.x = pos.x - 4*math.cos(yaw)
pos.z = pos.z-p.z pos.y = pos.y - 3
pos.z = pos.z - 4*math.sin(yaw)
clicker:set_detach() clicker:set_detach()
default.player_set_animation(clicker, "stand" , 30)
minetest.after(0.2, function()
clicker:setpos(pos) clicker:setpos(pos)
self.object:setvelocity({x=0, y=0, z=0}) end)
--self.object:setvelocity({x=0, y=0, z=0})
self.front_vel_target = 0
self.vert_vel_target = 0
elseif not self.driver then elseif not self.driver then
self.driver = clicker self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=0,z=0}, {x=0,y=0,z=0}) clicker:set_attach(self.object, "", {x=0,y=0,z=10}, {x=0,y=0,z=-10})
self.object:set_animation({x=55, y=60}, 15, 1) default.player_set_animation(clicker, "sit" , 30)
self.object:set_animation({x=60, y=60}, FPS, 0)
end end
end end
function hunter:on_activate(staticdata, dtime_s) function patroller:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1}) self.object:set_armor_groups({immortal=1})
--[[
if staticdata then if staticdata then
self.v = tonumber(staticdata) self.v = tonumber(staticdata)
end end
]]
end end
function hunter:get_staticdata()
return tostring(v) function patroller:get_staticdata()
return "" --tostring(v)
end end
function hunter:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
self.object:remove()
if puncher and puncher:is_player() then
puncher:get_inventory():add_item("main", "technology:hunter")
end
end
function hunter:on_step(dtime)
local command_increment = 0.05
hunter_step_tick = 0
function patroller:on_step(dtime)
-- make fire if damages are over 50% -- make fire if damages are over 50%
if self.object:get_hp() < 50 then
print("hunter is burning")
local pos = self.object:getpos()
pos.x = pos.x + math.random(-2,2)
pos.y = pos.y + math.random(-2,2)
pos.z = pos.z + math.random(-2,2)
minetest.env:set_node(pos, {name="fire:basic_flame"})
self.z = self.z - 0.1
end
-- explode when hp is under 5 -- explode when hp is under 5
hunter_step_tick = hunter_step_tick+dtime
if self.object:get_hp() < 5 then if self.object:get_hp() < 5 then
explosion(self.object:getpos(), 30) explosion(self.object:getpos(), 30)
end end
local velocity = self.object:getvelocity()
-- have user commands local command = false
self.v = get_v(velocity)*get_sign(self.v) --[[
if math.random(1,10) == 1 then
local yaw = self.object:getyaw()
local dir = {
x = math.cos(yaw),
y = 0,
z = math.sin(yaw),
}
self:fire(dir)
end
]]
if self.driver then if self.driver then
local ctrl = self.driver:get_player_control() local ctrl = self.driver:get_player_control()
if ctrl.up then if hunter_step_tick > 0.1 then
self.v = self.v+0.4 hunter_step_tick = 0
-- have user commands
if ctrl.up and self.front_vel_target < 1 then
self.front_vel_target = self.front_vel_target + command_increment
command = true
elseif ctrl.down and self.front_vel_target > -0.05 then
self.front_vel_target = self.front_vel_target - command_increment
command = true
end
if ctrl.jump and self.vert_vel_target < 1 then
self.vert_vel_target = self.vert_vel_target + command_increment
command = true
elseif ctrl.sneak and self.vert_vel_target > -1 then
self.vert_vel_target = self.vert_vel_target - command_increment
command = true
end end
if ctrl.down then
self.v = self.v-0.4
end end
if ctrl.left then if ctrl.left then
self.object:setyaw(self.object:getyaw()+math.pi/120+dtime*math.pi/120) self.object:setyaw(self.object:getyaw()+math.pi/120+dtime*math.pi/120)
--self.object:set_animation({x=5, y=5}, 1, 0) self.object:set_animation({x=5, y=5}, FPS, 0)
end command = true
if ctrl.right then elseif ctrl.right then
self.object:setyaw(self.object:getyaw()-math.pi/120-dtime*math.pi/120) self.object:setyaw(self.object:getyaw()-math.pi/120-dtime*math.pi/120)
--self.object:set_animation({x=15, y=15}, 1, 0) self.object:set_animation({x=10, y=10}, FPS, 0)
end command = true
if ctrl.jump then
self.z = self.z+0.15
end
if ctrl.sneak then
self.z = self.z-0.15
end
end
local z = get_sign(self.z)
self.z = self.z - 0.02*z
if z ~= get_sign(self.z) then
self.object:setvelocity({x=0,y=0,z=0})
self.z = 0
return
end
if math.abs(self.z) > 4.5 then
self.z = 4.5*get_sign(self.z)
end
local s = get_sign(self.v)
self.v = self.v - 0.02*s
if s ~= get_sign(self.v) then
self.object:setvelocity({x=0, y=0, z=0})
self.v = 0
return
end
if math.abs(self.v) > 6 then
self.v = 6*get_sign(self.v)
end
self.object:setacceleration({x=0, y=0, z=0})
if math.abs(self.object:getvelocity().y) < 0.01 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y)+0
self.object:setpos(pos)
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.z))
else else
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.z)) --self.object:set_animation({x=60, y=60}, FPS, 0)
end end
else
self.front_vel_target = 0
self.vert_vel_target = 0
--command = true
self.object:setvelocity({x=0, y=0, z=0})
self.object:set_animation({x=54, y=54}, FPS, 0)
end
if command then
local yaw = self.object:getyaw()
self.object:setvelocity({
x = self.front_vel_target * self.max_front_vel * math.cos(yaw),
y = self.vert_vel_target * self.max_vert_vel,
z = self.front_vel_target * self.max_front_vel * math.sin(yaw),
})
if self.vert_vel_target < 0 then
local frame = 40-5*self.vert_vel_target + 0.5
self.object:set_animation({x=frame, y=frame}, FPS, 0)
else
local frame = 30+5*self.vert_vel_target - 0.5
self.object:set_animation({x=frame, y=frame}, FPS, 0)
end
end
--[[
local Kf = 3.1
local Kv = 3.1
local v = self.object:getvelocity()
local yaw = self.object:getyaw()
local front_vel = v.x * -math.sin(yaw) + v.z * math.cos(yaw)
local vert_vel = v.y
local front_acc = Kf*(self.max_front_vel*self.front_vel_target - front_vel)
local vert_acc = Kv*(self.max_vert_vel*self.vert_vel_target - vert_vel)
self.object:setacceleration({x=-front_acc*math.sin(yaw), y=vert_acc, z=front_acc*math.cos(yaw)})
]]
--print("command "..self.front_vel_target.." "..self.vert_vel_target)
--print("command "..front_acc.." "..vert_acc)
end end
minetest.register_entity("technology:hunter", hunter) minetest.register_entity("technology:patroller", patroller)
minetest.register_craftitem("technology:hunter", { minetest.register_craftitem("technology:patroller", {
description = "hunter flying", description = "patroller flying",
inventory_image = "hunter_inv.png", inventory_image = "hunter_inv.png",
wield_image = "hunter_inv.png", wield_image = "hunter_inv.png",
wield_scale = {x=2, y=2, z=1}, wield_scale = {x=2, y=2, z=1},
@ -173,11 +283,22 @@ minetest.register_craftitem("technology:hunter", {
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return return
end end
print("hunter added !!!") print("patroller added !!!")
pointed_thing.under.y = pointed_thing.under.y+2 pointed_thing.under.y = pointed_thing.under.y+2
minetest.env:add_entity(pointed_thing.under, "technology:hunter") minetest.env:add_entity(pointed_thing.under, "technology:patroller")
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
end, end,
}) })
technology.register_plan("PATROLLER", "technology:patroller", "technology_plan_patroller.png", {
"technic:hv_transformer",
"technic:mv_transformer",
"technic:motor 8",
"technology:wire 10",
"default:steel_ingot 6",
"default:silver_ingot 1",
"default:mese 1",
"firearms:shell_12 1",
})

0
models/chasseur.blend → assets/chasseur.blend Executable file → Normal file
View File

BIN
assets/elevator.blend Normal file

Binary file not shown.

BIN
assets/elevator.blend1 Normal file

Binary file not shown.

BIN
assets/mask.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
assets/patroller.blend Normal file

Binary file not shown.

BIN
assets/patroller.blend1 Normal file

Binary file not shown.

BIN
assets/patroller.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,4 @@
default default
moreores moreores
mesecons mesecons
technic

View File

@ -2,7 +2,41 @@ This mod add computers and screen to minetest
made by jimy byerley jimy.byerley@gmail.com made by jimy byerley jimy.byerley@gmail.com
License is GNU GPL v2, do it what you want ! License is GNU GPL v2, do it what you want !
==[ crafting ]========================================== ==[ crafting advanced machines ]==============================
For complex machines, there is not any long chain of crafting. In reality when you want to build a complex machine, you actually have a overall plan and you just have to follow it to assemble essentials components right ?
So it's the same here with machines. You have to get an overall plan of a mechanism and just put it in the craft table with required components ... and it's finished !
Yet the problem is to get the overall plan. There is currently only one way to get it: have it generated by a computer: my computer mod. Idealy, this mod would require a sketching table node to achieve plans.
* enter the following command in a computer :
design ELEVATOR
(replace 'ELEVATOR' by the plan name of the machine you want) then the plan is added in your inventory.
put it randomly in the crafting table with components Image
then you have the machine crafted.
- Patroller -
machine name: PATROLLER
components:
8 motor from technic
1 HV transformer from technic
1 MV transformer from technic
10 mesecon line (alias electric wire)
6 steel ingot
1 silver ingot
the plan
- Elevator -
machine name: ELEVATOR
components:
1 motor from technic
1 HV transformer from technic
4 mesecon line
6 bronze ingot
the plan
==[ crafting nodes ]==========================================
plastic : put cotton in furnace plastic : put cotton in furnace

251
elevator.lua Normal file
View File

@ -0,0 +1,251 @@
local elevator = {
hp_max = 400,
can_punch = true,
physical = true,
collisionbox = {-1, -0.5, -1, 1, 2.5, 1},
visual = "mesh",
mesh = "elevator.x",
textures = {"technology_elevator.png"},
item = "technology:elevator",
marks = {}, -- list of floors to stop to
passengers = {}, -- list of current passengers
direction = 0,
direction_change = false, -- enable for step to take the direction change in count
target = 0, -- altitude to reach
}
local elevator_radius = 1
local elevator_speed = 3
local elevator_rail = "technology:elevator_rail"
local elevator_mark = "default:sign_wall_steel"
local elevator_entity = "technology:elevator_entity"
function yaw(object)
if object:is_player() then return object:get_look_horizontal()
else return object:getyaw()
end
end
function elevator:is_player_inside(player)
print(player:get_player_name().." enter an elevator as passenger n°"..#self.passengers.."")
for i,passenger in pairs(self.passengers) do
if player == passenger then return true end
end
return false
end
function elevator:set_direction(direction)
print("elevator take direction "..direction.." to target "..self.target)
self.direction = direction
self.direction_change = true
if self.sound_loop then minetest.sound_stop(self.sound_loop) end
if direction==0 then
self.sound_loop = minetest.sound_play("elevator_close", {object=self.object, max_hear_distance = 10, loop=false})
self.target = 0
else
if self.sound_loop then minetest.sound_stop(self.sound_loop) end
self.sound_loop = minetest.sound_play("elevator_loop", {object=self.object, max_hear_distance = 10, loop=true})
end
end
function elevator:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
if self:is_player_inside(puncher) then -- punch an elevator to go up or down
if self.direction == 0 then
local look = puncher:get_look_vertical()
local p = self.object:getpos()
self:regenerate_marks() -- search for a mark, that can haven't been already searched
if #self.marks == 0 then return end
if look < 0 then -- look up
local i=1
while i<=#self.marks and self.marks[i]<=p.y do i = i+1 end
if self.marks[i] == p.y then return end
self.target = self.marks[i]
self:set_direction(1)
else -- look down
local i=#self.marks
while i>0 and self.marks[i]>=p.y do i = i-1 end
if self.marks[i] == p.y then return end
self.target = self.marks[i]
self:set_direction(-1)
end
else self:set_direction(0) -- uncomment it if elevators mustn't be stopped from the interior
end
elseif puncher:get_wielded_item():get_name() == "technology:wrench" then
puncher:get_inventory():add_item("technology:elevator", 1)
self.object:remove()
end
end
function elevator:on_rightclick(clicker)
if self:is_player_inside(clicker) then -- the passenger exits
local y = yaw(clicker)
local pos = self.object:getpos()
local p = {
x=pos.x + -(elevator_radius+0.5)*math.sin(y),
y=pos.y+0.5,
z=pos.z + -(elevator_radius+0.5)*-math.cos(y)
}
if (not minetest.get_node({x=p.x, y=pos.y, z=p.z}).walkable) and
(not minetest.get_node({x=p.x, y=pos.y+1, z=p.z}).walkable) then
clicker:setpos(p)
clicker:set_detach(self.object)
for i,passenger in pairs(self.passengers) do if passenger==clicker then break end end
table.remove(self.passengers, i)
minetest.after(0.2, function()
clicker:setpos(p)
end)
else
minetest.chat_send_player(clicker:get_player_name(), "area is too small to bail out")
end
else -- the player enter the elevator
-- the program comes here if the clicker is not a passenger
-- make it become one
table.insert(self.passengers, clicker)
clicker:set_attach(self.object, "", {x=0,y=0,z=10}, {x=0,y=0,z=-10})
end
end
function elevator:on_step(dtime)
-- check up for direction change
if self.direction_change then
self.object:set_velocity({x=0,y=self.direction*elevator_speed,z=0})
self.direction_change = false
else
-- wait for a stop
local p = self.object:getpos()
if self.direction > 0 and p.y+elevator_speed*dtime >= self.target then
self.object:setpos({x=p.x, y=self.target, z=p.z})
self.object:set_velocity({x=0, y=0, z=0})
self:set_direction(0)
elseif self.direction < 0 and p.y-elevator_speed*dtime <= self.target then
self.object:setpos({x=p.x, y=self.target, z=p.z})
self.object:set_velocity({x=0, y=0, z=0})
self:set_direction(0)
end
end
if self.object:get_hp() <= 5 then
self.object:remove()
return
end
end
local r = elevator_radius+0.7
local elevator_marks_slots = { {r,-0.5},{r,0.5}, {-0.5,r},{0.5,r}, {-r,-0.5},{-r,0.5}, {-0.5,-r},{0.5,-r} }
local elevator_mark_height = 1.5
function elevator:regenerate_marks()
local y = self.object:getyaw()
local p = self.object:getpos()
rail_x = p.x + (elevator_radius+0.5) * math.cos(y) -- rail on the side
rail_z = p.z + (elevator_radius+0.5) * math.sin(y)
rail_y = p.y+elevator_mark_height+1
while minetest.get_node({x=rail_x, y=rail_y, z=rail_z}).name == elevator_rail do
for i,place in pairs(elevator_marks_slots) do
if minetest.get_node({x=p.x + place[1], y=rail_y, z=p.z + place[2]}).name == elevator_mark then
table.insert(self.marks, rail_y-elevator_mark_height)
break
end
end
rail_y = rail_y+1
end
rail_y = p.y+elevator_mark_height-1
while minetest.get_node({x=rail_x, y=rail_y, z=rail_z}).name == elevator_rail do
for i,place in pairs(elevator_marks_slots) do
if minetest.get_node({x=p.x + place[1], y=rail_y, z=p.z + place[2]}).name == elevator_mark then
table.insert(self.marks, 1, rail_y-elevator_mark_height)
break
end
end
rail_y = rail_y-1
end
end
minetest.register_entity(elevator_entity, elevator)
minetest.register_craftitem("technology:elevator", {
description = "Elevator",
inventory_image="technology_elevator_item.png",
wield_image = "technology_elevator_item.png",
wield_scale = {x=6, y=6, z=2},
on_place = function(itemstack, placer, pointed_thing)
local p = pointed_thing.under
local y = yaw(placer)
-- select direction to place to
print(y)
local o = 0
if 7*math.pi/4 < y or y <= math.pi/4 then o = 0
elseif math.pi/4 < y and y <= 3*math.pi/4 then o = math.pi/2
elseif 3*math.pi/4 < y and y <= 5*math.pi/4 then o = math.pi
else o = 3*math.pi/2
end
p.y = p.y + 0.5
p.x = p.x + 1.5*math.sin(o) + 0.5*math.cos(o)
p.z = p.z - 1.5*math.cos(o) + 0.5*math.sin(o)
local obj = minetest.add_entity(p, elevator_entity)
obj:setyaw(o)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})
local metal_footstep = {
footstep = {name="metal_footstep", gain=0.8},
dig = {name="metal_footstep", gain = 0.8},
}
local ec = 0.05 -- size of electric cables
local sc = 0.1 -- size of support cables
local zmin = -0.5
local zmax = 0.5
minetest.register_node("technology:elevator_rail", {
description = "Vertical rail for elevator",
node_placement_prediction = "",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {type = "fixed", fixed = {
{ -0.05, zmin, 0.2, 0.05, zmax, 0.5 }, -- guidance rail
{ -0.1, zmin, 0.45, 0.1, zmax, 0.5 }, -- guidance rail part 2
{ 0.4, zmin, -0.1, 0.4+sc, zmax, -0.1+sc }, -- support cable
{ -0.3, zmin, 0.4, -0.3+ec, zmax, 0.4+ec }, -- electric cable
{ -0.4, zmin, 0.4, -0.4+ec, zmax, 0.4+ec }, -- electric cable
}},
selection_box = {type = "fixed", fixed = {
{-0.5, zmin, 0.2, 0.5, zmax, 0.5},
}},
tiles = {
"technology_elevator_rail_front.png", --top
"technology_elevator_rail_front.png", --bottom
"technology_elevator_rail_right.png", --right
"technology_elevator_rail_left.png", --left
"technology_elevator_rail_back.png", --back
"technology_elevator_rail_front.png" --front
},
walkable = true,
groups = {mechanic=1, oddly_breakable_by_hand=1},
--on_punch = metal_punch,
sounds = metal_footstep,
})
technology.register_plan("ELEVATOR", "technology:elevator", nil, {
"technic:hv_transformer 1",
"technic:motor 1",
"technology:wire 2",
"default:bronze_ingot 6",
})
technology.register_plan("ELEVATOR_RAIL", "technology:elevator_rail", nil, {
"technology:wire 1",
"default:steel_ingot 1",
})

View File

@ -16,12 +16,11 @@ minetest.register_craftitem("technology:plastic", {
inventory_image = "plastic_item.png", inventory_image = "plastic_item.png",
}) })
dofile(minetest.get_modpath("technology").."/tools.lua") local technology_path = minetest.get_modpath("technology")
dofile(technology_path.."/plans.lua")
dofile(minetest.get_modpath("technology").."/structures.lua") dofile(technology_path.."/tools.lua")
dofile(technology_path.."/structures.lua")
dofile(minetest.get_modpath("technology").."/electric_nodes.lua") dofile(technology_path.."/electric_nodes.lua")
dofile(technology_path.."/aircraft.lua")
dofile(minetest.get_modpath("technology").."/aircraft.lua") dofile(technology_path.."/elevator.lua")
dofile(technology_path.."/screen.lua")
dofile(minetest.get_modpath("technology").."/screen.lua")

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

2888
models/elevator.x Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

9819
models/patroller.x Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

51
plans.lua Normal file
View File

@ -0,0 +1,51 @@
technology.registered_plans = {}
technology.register_plan = function (machine_name, machine_item, sketch_image, components)
local item_name = "technology:plan_"..machine_name
local sketch = sketch_image or "technology_plan_default.png"
minetest.register_node(":"..item_name, {
description = "overall plan for "..machine_name,
drawtype = "signlike",
tile_images = {sketch},
inventory_image = sketch,
wield_image = sketch,
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
metadata_name = "sign",
selection_box = {
type = "wallmounted",
--wall_top = <default>
--wall_bottom = <default>
--wall_side = <default>
},
groups = {choppy=2,dig_immediate=2,flammable=2},
legacy_wallmounted = true,
--sounds = default.node_sound_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]")
meta:set_string("infotext", machine_name)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
fields.text = fields.text or ""
meta:set_string("text", fields.text)
meta:set_string("infotext", machine_name..' ['..fields.text..']')
end,
})
components[#components+1] = item_name
minetest.register_craft({
output = machine_item,
type = "shapeless",
recipe = components,
})
technology.registered_plans[machine_name] = {item_name, machine_item, components}
end

View File

@ -3,6 +3,7 @@ local screens = {
"technology:flat_screen_on", "technology:flat_screen_on",
"technology:flat_screen_text", "technology:flat_screen_text",
"technology:flat_screen_compiling", "technology:flat_screen_compiling",
"technology:flat_screen_design",
} }
-- crafting -- crafting
@ -135,6 +136,36 @@ minetest.register_node("technology:flat_screen_compiling", {
drop = 'technology:flat_screen_off', drop = 'technology:flat_screen_off',
}) })
minetest.register_node("technology:flat_screen_design", {
description = "modern screen",
node_placement_prediction = "",
paramtype = "light",
light_source = 3,
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {type = "fixed", fixed = {
{-0.45, -0.4, 0.3, 0.45, 0.3, 0.25},
{-0.35, -0.35, 0.3, 0.35, 0.25, 0.4},
}},
selection_box = {type = "fixed", fixed = {
{-0.45, -0.4, 0.3, 0.45, 0.3, 0.25},
{-0.35, -0.35, 0.3, 0.35, 0.25, 0.4},
}},
tiles = {"screen_flat_top.png", "screen_flat_bottom.png", "screen_flat_left.png",
"screen_flat_right.png", "screen_flat_back.png", {
image="screen_flat_animated_design.png",
backface_culling=false,
animation={type="vertical_frames", aspect_w=128, aspect_h=128, length=5}
}},
walkable = true,
groups = {choppy=2, dig_immediate=2},
on_punch = function(pos, node, puncher)
node.name = "technology:flat_screen_off"
minetest.set_node(pos, node)
end,
drop = 'technology:flat_screen_off',
})
local old_screens = {"technology:flat_screen_smalltext", local old_screens = {"technology:flat_screen_smalltext",
"technology:flat_screen_bigtext", "technology:flat_screen_2columns", "technology:flat_screen_map", "technology:flat_screen_bigtext", "technology:flat_screen_2columns", "technology:flat_screen_map",

BIN
sounds/elevator_close.ogg Normal file

Binary file not shown.

BIN
sounds/elevator_loop.ogg Normal file

Binary file not shown.

0
sounds/jackhammer_sound.ogg Executable file → Normal file
View File

0
sounds/metal_footstep.1.ogg Executable file → Normal file
View File

0
sounds/metal_footstep.2.ogg Executable file → Normal file
View File

0
sounds/metal_footstep.3.ogg Executable file → Normal file
View File

0
sounds/metal_footstep.4.ogg Executable file → Normal file
View File

View File

@ -71,7 +71,7 @@ end
local metal_footstep = { local metal_footstep = {
footstep = {name="metal_footstep", gain=0.8}, footstep = {name="metal_footstep", gain=0.8},
dug = {name="", gain = 0.8}, dig = {name="metal_footstep", gain = 0.8},
} }
minetest.register_node("technology:armature_h", { minetest.register_node("technology:armature_h", {
@ -93,8 +93,8 @@ minetest.register_node("technology:armature_h", {
}}, }},
tiles = {"steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_h_side.png", "steel_armature_h_side.png"}, tiles = {"steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_h_side.png", "steel_armature_h_side.png"},
walkable = true, walkable = true,
groups = {mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -117,8 +117,8 @@ minetest.register_node("technology:armature_v", {
}}, }},
tiles = {"steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_v_side.png", "steel_armature_v_side.png"}, tiles = {"steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_top.png", "steel_armature_v_side.png", "steel_armature_v_side.png"},
walkable = true, walkable = true,
groups = {mecanic=1}, groups = {cracky=1,mechanic=1,},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -140,8 +140,8 @@ minetest.register_node("technology:grid_v", {
}}, }},
tiles = {"bronze_grid_side.png", "bronze_grid_side.png", "bronze_grid_side.png", "bronze_grid_side.png", "bronze_grid_front.png", "steel_grid_front.png"}, tiles = {"bronze_grid_side.png", "bronze_grid_side.png", "bronze_grid_side.png", "bronze_grid_side.png", "bronze_grid_front.png", "steel_grid_front.png"},
walkable = true, walkable = true,
groups = {paffy=2}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -163,8 +163,8 @@ minetest.register_node("technology:grid_h", {
}}, }},
tiles = {"bronze_grid_side.png", "bronze_grid_front.png", "bronze_grid_side.png", "bronze_grid_front.png", "bronze_grid_side.png", "steel_grid_side.png"}, tiles = {"bronze_grid_side.png", "bronze_grid_front.png", "bronze_grid_side.png", "bronze_grid_front.png", "bronze_grid_side.png", "steel_grid_side.png"},
walkable = true, walkable = true,
groups = {paffy=2}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -243,8 +243,8 @@ minetest.register_node("technology:floor", {
}}, }},
tiles = {"floor_top.png", "floor_bottom.png", "floor_side.png", "floor_side.png", "floor_side.png", "floor_side.png"}, tiles = {"floor_top.png", "floor_bottom.png", "floor_side.png", "floor_side.png", "floor_side.png", "floor_side.png"},
walkable = true, walkable = true,
groups = {paffly=2, mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -274,8 +274,8 @@ minetest.register_node("technology:stairs", {
}}, }},
tiles = {"floor_top.png", "floor_bottom.png", "floor_side.png", "floor_side.png", "floor_side.png", "floor_side.png"}, tiles = {"floor_top.png", "floor_bottom.png", "floor_side.png", "floor_side.png", "floor_side.png", "floor_side.png"},
walkable = true, walkable = true,
groups = {paffly=2, mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -296,8 +296,8 @@ minetest.register_node("technology:edge", {
}}, }},
tiles = {"edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png"}, tiles = {"edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png"},
walkable = true, walkable = true,
groups = {paffly=2, mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -322,8 +322,8 @@ minetest.register_node("technology:edge_angle", {
}}, }},
tiles = {"edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png"}, tiles = {"edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png", "edge_side.png"},
walkable = true, walkable = true,
groups = {paffly=2, mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
drop = "technology:edge", drop = "technology:edge",
}) })
@ -344,8 +344,8 @@ minetest.register_node("technology:triangle", {
}}, }},
tiles = {"triangle_side.png", "triangle_side.png", "triangle_right.png", "triangle_left.png", "triangle_side.png", "triangle_side.png"}, tiles = {"triangle_side.png", "triangle_side.png", "triangle_right.png", "triangle_left.png", "triangle_side.png", "triangle_side.png"},
walkable = true, walkable = true,
groups = {paffly=2, mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -379,8 +379,8 @@ minetest.register_node("technology:ladder", {
tiles = {"technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png"}, tiles = {"technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png"},
walkable = true, walkable = true,
climbable = true, climbable = true,
groups = {paffly=2, mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })
@ -422,8 +422,8 @@ minetest.register_node("technology:ladder_closed", {
tiles = {"technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png"}, tiles = {"technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png", "technology_ladder.png"},
walkable = true, walkable = true,
climbable = true, climbable = true,
groups = {paffly=2, mecanic=1}, groups = {cracky=1,mechanic=1},
on_punch = metal_punch, --on_punch = metal_punch,
sounds = metal_footstep, sounds = metal_footstep,
}) })

4
textures/.directory Normal file
View File

@ -0,0 +1,4 @@
[Dolphin]
PreviewsShown=true
Timestamp=2018,3,23,17,15,39
Version=3

0
textures/battery_back.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/battery_side.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/battery_top.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/bronze_ingot.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
textures/bronze_lump.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/button_item.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/edge_side.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 170 B

0
textures/electronic_card_item.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

0
textures/floor_bottom.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 889 B

0
textures/floor_side.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 889 B

0
textures/floor_top.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/hydro_generator_front.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

0
textures/jackhammer.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/jackhammer_side.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/jackhammer_top.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 889 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

0
textures/lamp_box.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/lamp_box_on.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/lamp_small.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/lamp_small_ceiling.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/lamp_small_floor.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/lamp_small_on.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/lamp_small_on_ceiling.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/lamp_small_on_floor.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
textures/lamp_small_only.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
textures/patrouilleur-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

0
textures/plastic_item.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/resistor_item.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/resistor_side.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
textures/resistor_top.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

0
textures/screen_flat_back.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
textures/screen_flat_bottom.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 886 B

After

Width:  |  Height:  |  Size: 886 B

0
textures/screen_flat_front_2columns.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
textures/screen_flat_front_bigtext.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
textures/screen_flat_front_cybertronic.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

0
textures/screen_flat_front_map.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
textures/screen_flat_front_off.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 909 B

After

Width:  |  Height:  |  Size: 909 B

0
textures/screen_flat_front_smalltext.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
textures/screen_flat_left.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 886 B

After

Width:  |  Height:  |  Size: 886 B

Some files were not shown because too many files have changed in this diff Show More