Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mapserver_mod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Minetest
mapserver_mod
Commits
ae12aa35
Commit
ae12aa35
authored
4 years ago
by
BuckarooBanzay
Browse files
Options
Downloads
Patches
Plain Diff
overhaul ingame /search
parent
201ef7ce
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
search.lua
+21
-3
21 additions, 3 deletions
search.lua
with
21 additions
and
3 deletions
search.lua
+
21
−
3
View file @
ae12aa35
...
@@ -44,8 +44,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
...
@@ -44,8 +44,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
return
end
end
local
pos1
=
vector
.
subtract
(
item
.
pos
,
{
x
=
1
,
y
=
0
,
z
=
1
})
local
pos1
=
vector
.
subtract
(
item
.
pos
,
{
x
=
2
,
y
=
0
,
z
=
2
})
local
pos2
=
vector
.
add
(
item
.
pos
,
{
x
=
1
,
y
=
0
,
z
=
1
})
local
pos2
=
vector
.
add
(
item
.
pos
,
{
x
=
2
,
y
=
0
,
z
=
2
})
local
nodes
=
minetest
.
find_nodes_in_area
(
pos1
,
pos2
,
"air"
)
local
nodes
=
minetest
.
find_nodes_in_area
(
pos1
,
pos2
,
"air"
)
...
@@ -113,6 +113,13 @@ local function show_formspec(playername, data)
...
@@ -113,6 +113,13 @@ local function show_formspec(playername, data)
if
item
.
attributes
.
stock
==
"0"
then
if
item
.
attributes
.
stock
==
"0"
then
color
=
"#FF0000"
color
=
"#FF0000"
end
end
elseif
item
.
type
==
"poi"
then
-- point of interest
description
=
minetest
.
formspec_escape
(
(
item
.
attributes
.
name
or
"?"
)
..
" (owner: "
..
(
item
.
attributes
.
owner
or
"?"
)
..
")"
)
end
end
-- save description
-- save description
...
@@ -171,10 +178,21 @@ minetest.register_chatcommand("search", {
...
@@ -171,10 +178,21 @@ minetest.register_chatcommand("search", {
json
=
json
..
'"pos2": {"x":2048, "y":2048, "z":2048},'
json
=
json
..
'"pos2": {"x":2048, "y":2048, "z":2048},'
json
=
json
..
'"type":"'
..
type
..
'"'
json
=
json
..
'"type":"'
..
type
..
'"'
-- switch between types of queries
-- search for "out_item" if it is a shop or for "owner" if bones are wanted
local
key_name
=
"unknown"
if
type
==
"poi"
then
key_name
=
"name"
elseif
type
==
"bones"
then
key_name
=
"owner"
elseif
type
==
"shop"
then
key_name
=
"out_item"
end
if
query
and
query
~=
"*"
then
if
query
and
query
~=
"*"
then
json
=
json
..
','
json
=
json
..
','
json
=
json
..
'"attributelike":{'
json
=
json
..
'"attributelike":{'
json
=
json
..
'"key":"
out_item
",'
json
=
json
..
'"key":"
'
..
key_name
..
'
",'
json
=
json
..
'"value":"%'
..
query
..
'%"'
json
=
json
..
'"value":"%'
..
query
..
'%"'
json
=
json
..
"}"
json
=
json
..
"}"
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