Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna
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
illuna
Commits
9b6e44b7
Commit
9b6e44b7
authored
7 years ago
by
Milan
Browse files
Options
Downloads
Patches
Plain Diff
add admin replacer tool
parent
46e0138f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
replacer.lua
+53
-0
53 additions, 0 deletions
replacer.lua
textures/replacer_replacer_admin.png
+0
-0
0 additions, 0 deletions
textures/replacer_replacer_admin.png
with
53 additions
and
0 deletions
replacer.lua
0 → 100644
+
53
−
0
View file @
9b6e44b7
-- Admin replacer extension for Sokomine's replacer mod
-- range was added and texture updated.
-- Everything else below is code by Sokomine.
minetest
.
register_tool
(
":replacer:replacer_admin"
,
{
description
=
"Admin node replacement tool"
,
groups
=
{},
inventory_image
=
"replacer_replacer_admin.png"
,
wield_image
=
""
,
wield_scale
=
{
x
=
1
,
y
=
1
,
z
=
1
},
stack_max
=
1
,
-- it has to store information - thus only one can be stacked
liquids_pointable
=
true
,
-- it is ok to painit in/with water
node_placement_prediction
=
nil
,
metadata
=
"default:dirt"
,
-- default replacement: common dirt
range
=
12
,
on_place
=
function
(
itemstack
,
placer
,
pointed_thing
)
if
(
placer
==
nil
or
pointed_thing
==
nil
)
then
return
itemstack
;
-- nothing consumed
end
local
name
=
placer
:
get_player_name
();
local
keys
=
placer
:
get_player_control
();
if
(
not
(
keys
[
"sneak"
]
))
then
return
replacer
.
replace
(
itemstack
,
placer
,
pointed_thing
,
0
);
end
if
(
pointed_thing
.
type
~=
"node"
)
then
minetest
.
chat_send_player
(
name
,
" Error: No node selected."
);
return
nil
;
end
local
pos
=
minetest
.
get_pointed_thing_position
(
pointed_thing
,
under
);
local
node
=
minetest
.
env
:
get_node_or_nil
(
pos
);
local
metadata
=
"default:dirt 0 0"
;
if
(
node
~=
nil
and
node
.
name
)
then
metadata
=
node
.
name
..
' '
..
node
.
param1
..
' '
..
node
.
param2
;
end
itemstack
:
set_metadata
(
metadata
);
minetest
.
chat_send_player
(
name
,
"Node replacement tool set to: '"
..
metadata
..
"'."
);
return
itemstack
;
-- nothing consumed but data changed
end
,
on_use
=
function
(
itemstack
,
user
,
pointed_thing
)
return
replacer
.
replace
(
itemstack
,
user
,
pointed_thing
,
above
);
end
,
})
This diff is collapsed.
Click to expand it.
textures/replacer_replacer_admin.png
0 → 100644
+
0
−
0
View file @
9b6e44b7
461 B
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