Merge pull request #1 from Thomas--S/items
Allow 99 items (independent of stacks) instead of 5 stacks
This commit is contained in:
commit
17b50a39c0
@ -19,7 +19,7 @@ Instructions:
|
||||
|
||||
Important to know:
|
||||
- 12 units of hydrogen are sufficient for a flight of 6 minutes
|
||||
- Maximum 5 items stacks in your inventory are allowed including the controller.
|
||||
- Maximum of 99 items in your inventory are allowed including the controller.
|
||||
Otherwise you would be too heavy :-)
|
||||
- The Jetpack also wears out and can be used for approximately 10 flights
|
||||
- Always hold the controller tight during the flight, otherwise it will switch off :)
|
||||
|
26
init.lua
26
init.lua
@ -13,13 +13,16 @@
|
||||
-- Load support for I18n.
|
||||
local S = minetest.get_translator("ta4_jetpack")
|
||||
|
||||
local ta4_jetpack = {}
|
||||
|
||||
local Players = {}
|
||||
local Jetpacks = {}
|
||||
local ItemsBlocklist = {}
|
||||
|
||||
local MAX_HEIGHT = tonumber(minetest.settings:get("ta4_jetpack_max_height")) or 500
|
||||
local MAX_VSPEED = tonumber(minetest.settings:get("ta4_jetpack_max_vertical_speed")) or 20
|
||||
local MAX_HSPEED = (tonumber(minetest.settings:get("ta4_jetpack_max_horizontal_speed")) or 12) / 4
|
||||
local MAX_NUM_INV_ITEMS = tonumber(minetest.settings:get("ta4_jetpack_max_num_inv_items")) or 5
|
||||
local MAX_NUM_INV_ITEMS = tonumber(minetest.settings:get("ta4_jetpack_max_num_inv_items")) or 99
|
||||
|
||||
-- Flight time maximum 6 min or 360 s or 3600 steps.
|
||||
-- 12 units hydrogen for 3600 steps means 0.0033 units hydrogen / step.
|
||||
@ -31,6 +34,11 @@ local STEPS_TO_FUEL = 0.0033
|
||||
|
||||
local WEAR_VALUE = 180 -- roughly 10 flys, 6 min each
|
||||
|
||||
-- API function to register items that are forbidden in inventory during flight.
|
||||
ta4_jetpack.register_forbidden_item = function(itemname)
|
||||
ItemsBlocklist[itemname] = true
|
||||
end
|
||||
|
||||
local function store_player_physics(player)
|
||||
local meta = player:get_meta()
|
||||
-- Check access conflicts with other mods
|
||||
@ -143,19 +151,22 @@ local function check_player_load(player)
|
||||
local bags_meta = meta:get_string("unified_inventory:bags")
|
||||
if bags_meta then
|
||||
if next(minetest.deserialize(bags_meta) or {}) then
|
||||
return S("check your bags!")
|
||||
return S("You are too heavy: Check your bags!")
|
||||
end
|
||||
end
|
||||
for _, stack in ipairs(inv:get_list("craft") or {}) do
|
||||
if not stack:is_empty() then
|
||||
return S("check your carfting menu!")
|
||||
return S("You are too heavy: Check your crafting menu!")
|
||||
end
|
||||
end
|
||||
local count = 0
|
||||
for _, stack in ipairs(inv:get_list("main") or {}) do
|
||||
count = count + (stack:is_empty() and 0 or 1)
|
||||
count = count + stack:get_count()
|
||||
if count > MAX_NUM_INV_ITEMS then
|
||||
return S("check your inventory!")
|
||||
return S("You are too heavy: Check your inventory!")
|
||||
end
|
||||
if ItemsBlocklist[stack:get_name()] then
|
||||
return S("You may not transport @1 with a jetpack!", stack:get_description())
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -349,7 +360,7 @@ local function turn_controller_on_off(itemstack, user)
|
||||
-- check inventory load
|
||||
local res = check_player_load(user)
|
||||
if res then
|
||||
minetest.chat_send_player(name, S("[Jetpack] You are too heavy: ")..res)
|
||||
minetest.chat_send_player(name, S("[Jetpack]").." "..res)
|
||||
return itemstack
|
||||
end
|
||||
-- check fuel
|
||||
@ -533,3 +544,6 @@ techage.add_manual_items({
|
||||
ta4_jetpack = "ta4_jetpack.png",
|
||||
ta4_jetpack_controller = 'ta4_jetpack_controller_inv.png'})
|
||||
|
||||
ta4_jetpack.register_forbidden_item("techage:cylinder_large_hydrogen")
|
||||
ta4_jetpack.register_forbidden_item("techage:cylinder_small_hydrogen")
|
||||
ta4_jetpack.register_forbidden_item("techage:hydrogen")
|
||||
|
@ -5,10 +5,11 @@ TA4 Jetpack=TA4 Jetpac
|
||||
TA4 Jetpack Controller Off=TA4 Jetpack Controller Aus
|
||||
TA4 Jetpack Controller On=TA4 Jetpack Controller An
|
||||
Use the controller (left click) to fill the tank with hydrogen=Benutze den Controller (linksklick) um den Tank mit Wasserstoff zu füllen
|
||||
[Jetpack] You are too heavy: =[Jetpack] Du bist zu schwer:
|
||||
You are too heavy: Check your bags!=Du bist zu schwer: Prüfe deine Rucksäcke!
|
||||
You are too heavy: Check your crafting menu!=Du bist zu schwer: Prüfe dein Crafting Menü!
|
||||
You are too heavy: Check your inventory!=Du bist zu schwer: Prüfe dein Inventar!
|
||||
You may not transport @1 with a jetpack!=Du darfst @1 nicht mit dem Jetpack transportieren!
|
||||
[Jetpack]=[Jetpack]
|
||||
[Jetpack] You don't have your jetpack on your back!=[Jetpack] Du hast dein Jetpack nicht auf dem Rücken!
|
||||
[Jetpack] Your tank is empty!=[Jetpack] Dein Tank ist leer!
|
||||
check your bags!=Prüfe deine Rucksäcke!
|
||||
check your carfting menu!=Prüfe dein Crafting Menü!
|
||||
check your inventory!=Prüfe dein Inventar!
|
||||
##### not used anymore #####
|
@ -3,9 +3,11 @@ TA4 Jetpack=
|
||||
TA4 Jetpack Controller Off=
|
||||
TA4 Jetpack Controller On=
|
||||
Use the controller (left click) to fill the tank with hydrogen=
|
||||
[Jetpack] You are too heavy: =
|
||||
You are too heavy: Check your bags!=
|
||||
You are too heavy: Check your crafting menu!=
|
||||
You are too heavy: Check your inventory!=
|
||||
You may not transport @1 with a jetpack!=
|
||||
[Jetpack]=
|
||||
[Jetpack] You don't have your jetpack on your back!=
|
||||
[Jetpack] Your tank is empty!=
|
||||
check your bags!=
|
||||
check your carfting menu!=
|
||||
check your inventory!=
|
||||
##### not used anymore #####
|
@ -17,7 +17,7 @@ techage.add_to_manual('DE', {
|
||||
"\n"..
|
||||
"\n",
|
||||
" - 12 Einheiten Wasserstoff reichen für einen Flug von 6 Minuten\n"..
|
||||
" - Maximal 5 Stapel von Gegenständen im Spieler-Inventar sind zulässig\\, einschließlich des Controllers\n(Sonst wärst du zu schwer :-)\n"..
|
||||
" - Maximal 99 Gegenstände im Spieler-Inventar sind zulässig\\, einschließlich des Controllers\n(Sonst wärst du zu schwer :-)\n"..
|
||||
" - Das Jetpack nutzt sich ab und kann für ca. 10 Flüge verwendet werden\n"..
|
||||
" - Halte den Controller während des Fluges immer fest\\, sonst schaltet er sich aus :)\n"..
|
||||
"\n"..
|
||||
|
@ -21,7 +21,7 @@ Das Jetpack ist inspiriert vom Jetpack von spirit689 (https://github.com/spirit6
|
||||
## Was du wissen solltest
|
||||
|
||||
- 12 Einheiten Wasserstoff reichen für einen Flug von 6 Minuten
|
||||
- Maximal 5 Stapel von Gegenständen im Spieler-Inventar sind zulässig, einschließlich des Controllers
|
||||
- Maximal 99 Gegenstände im Spieler-Inventar sind zulässig, einschließlich des Controllers
|
||||
(Sonst wärst du zu schwer :-)
|
||||
- Das Jetpack nutzt sich ab und kann für ca. 10 Flüge verwendet werden
|
||||
- Halte den Controller während des Fluges immer fest, sonst schaltet er sich aus :)
|
||||
|
@ -18,7 +18,7 @@ techage.add_to_manual('EN', {
|
||||
"\n"..
|
||||
"\n",
|
||||
" - 12 units of hydrogen are sufficient for a flight of 6 minutes\n"..
|
||||
" - Maximum 5 items stacks in your inventory are allowed including the controller.\nOtherwise you would be too heavy :-)\n"..
|
||||
" - Maximum 99 items in your inventory are allowed including the controller.\nOtherwise you would be too heavy :-)\n"..
|
||||
" - The Jetpack also wears out and can be used for approximately 10 flights\n"..
|
||||
" - Always hold the controller tight during the flight\\, otherwise it will switch off :)\n"..
|
||||
"\n"..
|
||||
|
@ -22,7 +22,7 @@ and by the historical game Lunar Lander.
|
||||
## Important to know
|
||||
|
||||
- 12 units of hydrogen are sufficient for a flight of 6 minutes
|
||||
- Maximum 5 items stacks in your inventory are allowed including the controller.
|
||||
- Maximum 99 items in your inventory are allowed including the controller.
|
||||
Otherwise you would be too heavy :-)
|
||||
- The Jetpack also wears out and can be used for approximately 10 flights
|
||||
- Always hold the controller tight during the flight, otherwise it will switch off :)
|
||||
|
@ -8,7 +8,7 @@ ta4_jetpack_max_vertical_speed (maximum vertical speed) int 20
|
||||
ta4_jetpack_max_horizontal_speed (maximum horizontal speed) int 12
|
||||
|
||||
# Maximum number of inventory items a player can take
|
||||
ta4_jetpack_max_num_inv_items (maximum number of inventory items) int 5
|
||||
ta4_jetpack_max_num_inv_items (maximum number of inventory items) int 99
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user