code cleanup (again)

master
cale 2016-03-21 18:13:51 +01:00
parent 950ba5ed48
commit cacb2c9b08
10 changed files with 50 additions and 10 deletions

View File

@ -1,6 +1,3 @@
Minetest 0.4 mod: uforun
==========================
License of source code:
-----------------------
This program is free software; you can redistribute it and/or modify

22
mods/gamedata/init.lua Normal file
View File

@ -0,0 +1,22 @@
-- This mod will be able to save and load tables from/to files
gamedata = {}
gamedata.data = {}
function gamedata.new(mod, data)
gamedata.data[mod] = data
end
function gamedata.set(mod, k, v)
gamedata.data[mod][k] = v
end
function gamedata.get(mod, k)
return gamedata.data[mod][k]
end
function gamedata.save()
end
function gamedata.load()
end

View File

@ -33,7 +33,7 @@ minetest.register_node("levelnodes:startline", {
on_punch = function(pos, node, puncher, pointed_thing)
if puncher:is_player() then
pos.y = pos.y +1
minetest.add_entity(pos, "uforun:ufo")
minetest.add_entity(pos, "ufo:ufo")
end
end
})

20
mods/teleport/init.lua Normal file
View File

@ -0,0 +1,20 @@
-- This mod will handle level teleportation
teleport = {}
teleport.players = {}
function teleport.tp(player)
local name = player:get_player_name()
if teleport.players[name] then
teleport.players[name] = 0
end
teleport.players[name] = teleport.players[name] + 1
player:setpos({x = teleport.players[name]*50, y = 10, z = 0})
end
function teleport.new_player(name)
teleport.players[name] = 0
end
function teleport.create_level(player)
-- teleports a player to an empty level
end

2
mods/ufo/depends.txt Normal file
View File

@ -0,0 +1,2 @@
uforun
teleport

View File

@ -12,9 +12,9 @@ local function get_v(v)
return math.sqrt(v.x^2+v.z^2)
end
minetest.register_entity("uforun:ufo", {
minetest.register_entity("ufo:ufo", {
visual = "wielditem",
textures = {"uforun:ufo"},
textures = {"ufo:ufo"},
visual_size = {x=0.667, y=0.667},
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
physical = true,
@ -41,7 +41,7 @@ minetest.register_entity("uforun:ufo", {
self.removed = true
self.object:remove()
if not minetest.setting_getbool("creative_mode") then
puncher:get_inventory():add_item("main", "uforun:ufo")
puncher:get_inventory():add_item("main", "ufo:ufo")
end
end
end,
@ -169,7 +169,7 @@ minetest.register_entity("uforun:ufo", {
end
})
minetest.register_node("uforun:ufo", {
minetest.register_node("ufo:ufo", {
description = "UFO",
drawtype = "nodebox",
paramtype = "light",
@ -185,7 +185,7 @@ minetest.register_node("uforun:ufo", {
if pointed_thing.type ~= "node" then
return
end
minetest.add_entity(pointed_thing.above, "uforun:ufo")
minetest.add_entity(pointed_thing.above, "ufo:ufo")
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end

View File

Before

Width:  |  Height:  |  Size: 83 B

After

Width:  |  Height:  |  Size: 83 B

View File

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

View File

Before

Width:  |  Height:  |  Size: 92 B

After

Width:  |  Height:  |  Size: 92 B

View File

@ -3,4 +3,3 @@ uforun = {}
local modpath = minetest.get_modpath("uforun")
dofile(modpath.."/player.lua")
dofile(modpath.."/ufo.lua")