Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory_plus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
inventory_plus
Commits
c168b4d5
Commit
c168b4d5
authored
12 years ago
by
Brett O'Donnell
Browse files
Options
Downloads
Patches
Plain Diff
added trash and refill slots - thanks @PilzAdam
parent
f27cea67
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory_plus/init.lua
+44
-4
44 additions, 4 deletions
inventory_plus/init.lua
with
44 additions
and
4 deletions
inventory_plus/init.lua
+
44
−
4
View file @
c168b4d5
...
...
@@ -51,6 +51,17 @@ inventory_plus.get_formspec = function(player,page)
..
"list[current_player;craftpreview;7,1;1,1;]"
end
-- creative page
if
page
==
"creative"
then
formspec
=
player
:
get_inventory_formspec
()
..
"button[5,0;2,0.5;main;Back]"
..
"label[6,1.5;Trash:]"
..
"list[detached:trash;main;6,2;1,1;]"
..
"label[5,1.5;Refill:]"
..
"list[detached:refill;main;5,2;1,1;]"
end
-- main page
if
page
==
"main"
then
-- buttons
local
x
,
y
=
0
,
0
...
...
@@ -67,6 +78,37 @@ inventory_plus.get_formspec = function(player,page)
return
formspec
end
-- trash slot
inventory_plus
.
trash
=
minetest
.
create_detached_inventory
(
"trash"
,
{
allow_put
=
function
(
inv
,
listname
,
index
,
stack
,
player
)
if
minetest
.
setting_getbool
(
"creative_mode"
)
then
return
stack
:
get_count
()
else
return
0
end
end
,
on_put
=
function
(
inv
,
listname
,
index
,
stack
,
player
)
inv
:
set_stack
(
listname
,
index
,
nil
)
end
,
})
inventory_plus
.
trash
:
set_size
(
"main"
,
1
)
-- refill slot
inventory_plus
.
refill
=
minetest
.
create_detached_inventory
(
"refill"
,
{
allow_put
=
function
(
inv
,
listname
,
index
,
stack
,
player
)
if
minetest
.
setting_getbool
(
"creative_mode"
)
then
return
stack
:
get_count
()
else
return
0
end
end
,
on_put
=
function
(
inv
,
listname
,
index
,
stack
,
player
)
inv
:
set_stack
(
listname
,
index
,
ItemStack
(
stack
:
get_name
()
..
" "
..
stack
:
get_stack_max
()))
end
,
})
inventory_plus
.
refill
:
set_size
(
"main"
,
1
)
-- register_on_joinplayer
minetest
.
register_on_joinplayer
(
function
(
player
)
inventory_plus
.
register_button
(
player
,
"craft"
,
"Craft"
)
...
...
@@ -92,10 +134,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
-- creative
if
fields
.
creative_prev
or
fields
.
creative_next
then
minetest
.
after
(
0
.
01
,
function
()
inventory_plus
.
set_inventory_formspec
(
player
,
player
:
get_inventory_formspec
()
..
"button[5,0;2,0.5;main;Back]"
)
return
end
)
inventory_plus
.
set_inventory_formspec
(
player
,
inventory_plus
.
get_formspec
(
player
,
"creative"
))
return
end
end
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment