Update Survival modpack.

This commit is contained in:
Splizard 2014-04-27 10:37:31 +12:00
parent f06b0e819a
commit 867d33fb15
18 changed files with 210 additions and 95 deletions

View File

@ -82,8 +82,8 @@ minetest.register_globalstep(function ( dtime )
dtime_count = 0;
for _, player in pairs(minetest.get_connected_players()) do
local pos = player:getpos();
local nodey0 = minetest.env:get_node(pos).name;
local nodey1 = minetest.env:get_node({ x=pos.x, y=pos.y+1, z=pos.z }).name;
local nodey0 = minetest.get_node(pos).name;
local nodey1 = minetest.get_node({ x=pos.x, y=pos.y+1, z=pos.z }).name;
local name = player:get_player_name();
local dmg0 = (materials[nodey0] and materials[nodey0].damage);
local dmg1 = (materials[nodey1] and materials[nodey1].damage);

View File

@ -0,0 +1,11 @@
# Language: Español
# Author: Diego Martínez
###init.lua###
Hazard Suit = Traje de Peligro
###toxicwaste.lua###
Toxic Waste Flowing = Flujo de Desechos Toxicos
Toxic Waste Source = Desechos Toxicos
Toxic Waste Bucket = Cubo de Desechos Toxicos

View File

@ -0,0 +1,11 @@
# Language: Français
# Author: Jat
###init.lua###
Hazard Suit = Combinaison de protection en milieu hostile
###toxicwaste.lua###
Toxic Waste Flowing = Flot de déchets toxiques
Toxic Waste Source = Source de déchets toxiques
Toxic Waste Bucket = Seau de déchets toxiques

View File

@ -0,0 +1,11 @@
# Language:
# Author:
###init.lua###
Hazard Suit =
###toxicwaste.lua###
Toxic Waste Flowing =
Toxic Waste Source =
Toxic Waste Bucket =

View File

@ -69,7 +69,8 @@ bucket.register_liquid(
"survival_hazards:toxic_waste_source",
"survival_hazards:toxic_waste_flowing",
"survival_hazards:bucket_toxic_waste",
"survival_hazards_bucket_waste.png"
"survival_hazards_bucket_waste.png",
S("Toxic Waste Bucket")
);
survival.hazards.register_liquid("survival_hazards:toxic_waste", {

View File

@ -129,23 +129,14 @@ end);
survival.register_state("hunger", {
label = S("Hunger");
item = {
name = "survival_hunger:meter";
description = S("Hunger Meter");
inventory_image = "survival_hunger_meter.png";
recipe = {
{ "", "default:wood", "" },
{ "default:wood", "default:apple", "default:wood" },
{ "", "default:wood", "" },
};
};
hud = {
pos = {x=0.730, y=0.945};
image = "default_apple.png";
--image = "survival_hunger_hud.png";
pos = {x=0.5, y=0.9};
offset = {x=-175, y=-15};
image = "survival_hunger_hud_apple.png";
};
get_default = function ( )
get_default = function ( hudidn )
return {
hudid = hudidn;
count = 0;
flag = false;
};
@ -160,7 +151,7 @@ survival.register_state("hunger", {
on_update = function ( dtime, player, state )
local name = player:get_player_name();
local privs = minetest.get_player_privs(name)
if privs.interact then
if privs.interact then
state.count = state.count + dtime;
if (state.flag and (state.count >= HUNGER_TIME)) then
local hp = player:get_hp();
@ -186,7 +177,7 @@ survival.register_state("hunger", {
max_hear_distance = 16;
});
end
end
end
end;
});

View File

@ -3,6 +3,5 @@
# Author: Diego Martínez <lkaezadl3@gmail.com>
You died from starvation. = Has muerto de hambre.
Hunger Meter = Medidor de Hambre
Hunger = Hambre
You are hungry. = Tienes hambre.

View File

@ -0,0 +1,7 @@
# Language: Français
# Author: Jat
You died from starvation. = Vous êtes mort de faim.
Hunger = Faim
You are hungry. = Vous avez faim.

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

View File

@ -26,23 +26,6 @@ dofile(minetest.get_modpath("survival_lib").."/chatcmds.lua");
survival.registered_states = { };
survival.register_state = function ( name, def )
if (def.item) then
if (def.item.name) then
minetest.register_tool(def.item.name, {
description = def.item.description or "<Unnamed item>";
inventory_image = def.item.inventory_image;
on_use = def.item.on_use;
});
if (def.item.recipe) then
minetest.register_craft({
output = def.item.name;
recipe = def.item.recipe;
});
end
else
def.item = nil;
end
end
if (def.command_name) then
local lbl = (def.label or def.command_name);
def.command_func = function ( name, param )
@ -83,7 +66,7 @@ end
survival.reset_player_state = function ( name, stname )
if (name and stname and survival.registered_states[stname]) then
player_states[name][stname] = survival.registered_states[stname].get_default();
player_states[name][stname] = survival.registered_states[stname].get_default(player_states[name][stname].hudid);
end
end
@ -147,7 +130,7 @@ minetest.register_on_joinplayer(function ( player )
for i, def in ipairs(survival.registered_states) do
local name = def.name;
if (not player_states[plname][name]) then
player_states[plname][name] = def.get_default();
player_states[plname][name] = def.get_default(nil);
end
end
minetest.after(0.5, function ( self )
@ -156,6 +139,7 @@ minetest.register_on_joinplayer(function ( player )
player_states[plname][def.name].hudid = player:hud_add({
hud_elem_type = "statbar";
position = def.hud.pos or HUD_DEFAULTS.pos;
offset = def.hud.offset;
scale = def.hud.scale or HUD_DEFAULTS.scale;
text = def.hud.image or HUD_DEFAULTS.image;
number = def.hud.number or HUD_DEFAULTS.number;

View File

@ -2,5 +2,4 @@
# Language: Español
# Author: Diego Martínez <lkaezadl3@gmail.com>
Test Meter = Medidor de Prueba
Display all player stats = Mostrar todas las estadisticas del jugador

View File

@ -0,0 +1,34 @@
# Language: Français
# Author: Jat
###init.lua###
Display %s = Afficher %s
Display all player stats = Affichez les statistiques des joueurs.
###chatcmds.lua###
<command> <args>... = <commande> <arguments>...
Configuration of survival_lib = Configuration de survival_lib
No subcommand specified. = Pas de sous-commande spécifiée.
Unknown subcommand `%s'. = `%s' sous-commande inconnue.
Missing privileges: %s = Le privilèges %s manquent
<subcommand> = <sous-commande>
Get help about a subcommand = Avoir de l'aide pour la sous-commande
Available commands: %s = Commande %s disponible
<state> = <état>
Enable a state = Activation de l'état
Unknown state `%s'. = `%s' cette état est inconnue.
State `%s' enabled. = Etat activer: `%s'
No state specified. = Etat non spécifié.
Disable a state = Désactivation de l'état
State `%s' disabled. = `%s' état désactivé.
Get the enabled/disabled flag of a state =
State `%s' is %s. = L'état `%s' est %s.
Enabled = Activé
Disabled = Désactivé
List available states and enabled/disabled flags = Liste des états disponibles et si il sont actif ou désactif.

View File

@ -0,0 +1,34 @@
# Language:
# Author:
###init.lua###
Display %s =
Display all player stats =
###chatcmds.lua###
<command> <args>... =
Configuration of survival_lib =
No subcommand specified. =
Unknown subcommand . =
Missing privileges: %s =
<subcommand> =
Get help about a subcommand =
Available commands: %s =
<state> =
Enable a state =
Unknown state `%s'. =
State `%s' enabled. =
No state specified. =
Disable a state =
State `%s' disabled. =
Get the enabled/disabled flag of a state =
State `%s' is %s. =
Enabled =
Disabled =
List available states and enabled/disabled flags =

View File

@ -1,2 +1,3 @@
default
survival_lib
vessels

View File

@ -15,7 +15,7 @@ end
local timer = 0;
minetest.register_craftitem("survival_thirst:water_glass", {
description = "Glass of Water";
description = S("Glass of Water");
inventory_image = "survival_thirst_water_glass.png";
groups = { drink=1; survival_no_override=1; };
stack_max = 10;
@ -40,20 +40,45 @@ minetest.register_craftitem("survival_thirst:water_glass", {
local alt_water_sources = {
["3dforniture:sink"] = true;
["homedecor:kitchen_cabinet_with_sink"] = true;
["default:water_source"] = true;
["default:water_flowing"] = true;
};
minetest.register_on_punchnode(function ( pos, node, puncher )
local item = puncher:get_wielded_item();
if ((item:get_name() == "vessels:drinking_glass")
and alt_water_sources[node.name]) then
local newitem = ItemStack("survival_thirst:water_glass 1");
local inv = puncher:get_inventory();
if (inv:room_for_item("main", newitem)) then
inv:remove_item("main", ItemStack(item:get_name().." 1"));
inv:add_item("main", newitem);
end
end
end);
minetest.register_craftitem(":vessels:drinking_glass", {
--Or use minetest.registered_items[vessels:drinking_glass] for all parametre.
description = S("Drinking Glass (empty)"),
drawtype = "plantlike",
tiles = {"vessels_drinking_glass.png"},
inventory_image = "vessels_drinking_glass_inv.png",
wield_image = "vessels_drinking_glass.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
},
groups = {vessel=1,dig_immediate=3,attached_node=1},
sounds = default.node_sound_glass_defaults(),
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node(pointed_thing.under)
if alt_water_sources[node.name] then
local newitem = ItemStack("survival_thirst:water_glass 1");
local inv = user:get_inventory();
if (inv:room_for_item("main", newitem)) then
inv:add_item("main", newitem);
if not(minetest.registered_items[node.name].liquidtype=="none") then
minetest.remove_node(pointed_thing.under);
end
itemstack:take_item();
return itemstack
end
end
end,
})
minetest.register_craft({
output = "survival_thirst:water_glass";
@ -119,23 +144,14 @@ end);
survival.register_state("thirst", {
label = S("Thirst");
item = {
name = "survival_thirst:meter";
description = S("Thirst Meter");
inventory_image = "survival_thirst_meter.png";
recipe = {
{ "", "default:wood", "" },
{ "default:wood", "vessels:drinking_glass", "default:wood" },
{ "", "default:wood", "" },
};
};
hud = {
pos = {x=0.720, y=0.965};
image = "survival_thirst_water_glass.png";
--image = "survival_thirst_hud.png";
pos = {x=0.5, y=0.9};
offset = {x=-10, y=-15};
image = "survival_thirst_hud_water_glass.png";
};
get_default = function ( )
get_default = function ( hudidn )
return {
hudid = hudidn;
count = 0;
thirsty = false;
};
@ -148,33 +164,40 @@ survival.register_state("thirst", {
end
end;
on_update = function ( dtime, player, state )
local name = player:get_player_name();
local privs = minetest.get_player_privs(name)
if (player:get_hp() > 0) and privs.interact then
state.count = state.count + dtime;
local name = player:get_player_name();
if (state.thirsty and (state.count >= PASS_OUT_TIME)) then
state.count = 0;
state.thirsty = false;
if (player:get_hp() > 0) then
minetest.chat_send_player(name, S("You died from dehydration."));
end
player:set_hp(0);
minetest.sound_play({ name="survival_thirst_pass_out" }, {
pos = player:getpos();
gain = 1.0;
max_hear_distance = 16;
});
elseif ((not state.thirsty) and (state.count >= THIRST_TIME)) then
state.count = 0;
state.thirsty = true;
minetest.sound_play({ name="survival_thirst_thirst" }, {
pos = player:getpos();
gain = 1.0;
max_hear_distance = 16;
});
minetest.chat_send_player(name, S("You are thirsty."));
end
if (player:get_hp() > 0) then
local name = player:get_player_name();
local privs = minetest.get_player_privs(name)
if privs.interact then
state.count = state.count + dtime;
if (state.thirsty and (state.count >= PASS_OUT_TIME)) then
state.count = 0;
state.thirsty = false;
if (player:get_hp() > 0) then
minetest.chat_send_player(name, S("You died from dehydration."));
end
player:set_hp(0);
minetest.sound_play({ name="survival_thirst_pass_out" }, {
pos = player:getpos();
gain = 1.0;
max_hear_distance = 16;
});
elseif ((not state.thirsty) and (state.count >= THIRST_TIME)) then
state.count = 0;
state.thirsty = true;
minetest.sound_play({ name="survival_thirst_thirst" }, {
pos = player:getpos();
gain = 1.0;
max_hear_distance = 16;
});
minetest.chat_send_player(name, S("You are thirsty."));
end
end
end
end;
});
minetest.register_on_dieplayer(function ( player )
survival.reset_player_state(player:get_player_name(), "thirst");
end);

View File

@ -5,5 +5,5 @@
You died from dehydration. = Has muerto de deshidratacion.
You are thirsty. = Tienes sed.
Thirst = Sed
Thirst Meter = Medidor de Sed
Glass of Water = Vaso de Agua
Drinking Glass (empty) = Vaso de Agua (vacío)

View File

@ -0,0 +1,9 @@
# Language: Français
# Author: Jat
You died from dehydration. = Vous étez mort de déshydratation.
You are thirsty. = Vous avez soif.
Thirst = Soif
Glass of Water = Verre d'eau
Drinking Glass (empty) = Verre d'eau (vide)

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B