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
52b5c97f
Commit
52b5c97f
authored
4 years ago
by
BuckarooBanzay
Browse files
Options
Downloads
Patches
Plain Diff
don't add empty shops to /search result
parent
0ab7477d
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
bridge/search.lua
+20
-9
20 additions, 9 deletions
bridge/search.lua
with
20 additions
and
9 deletions
bridge/search.lua
+
20
−
9
View file @
52b5c97f
...
@@ -91,6 +91,7 @@ local function show_formspec(playername, data)
...
@@ -91,6 +91,7 @@ local function show_formspec(playername, data)
local
coords
=
item
.
pos
.
x
..
"/"
..
item
.
pos
.
y
..
"/"
..
item
.
pos
.
z
local
coords
=
item
.
pos
.
x
..
"/"
..
item
.
pos
.
y
..
"/"
..
item
.
pos
.
z
local
description
=
""
local
description
=
""
local
color
=
"#FFFFFF"
local
color
=
"#FFFFFF"
local
add_to_list
=
true
-- don't trust any values in attributes, they might not be present
-- don't trust any values in attributes, they might not be present
if
item
.
type
==
"bones"
then
if
item
.
type
==
"bones"
then
...
@@ -102,6 +103,12 @@ local function show_formspec(playername, data)
...
@@ -102,6 +103,12 @@ local function show_formspec(playername, data)
elseif
item
.
type
==
"shop"
then
elseif
item
.
type
==
"shop"
then
-- shop
-- shop
if
item
.
attributes
.
stock
==
"0"
then
-- don't add empty vendors to the list
add_to_list
=
false
else
-- stocked shop
description
=
minetest
.
formspec_escape
(
"Shop, "
..
description
=
minetest
.
formspec_escape
(
"Shop, "
..
"trading "
..
(
item
.
attributes
.
out_count
or
"?"
)
..
"trading "
..
(
item
.
attributes
.
out_count
or
"?"
)
..
"x "
..
(
item
.
attributes
.
out_item
or
"?"
)
..
"x "
..
(
item
.
attributes
.
out_item
or
"?"
)
..
...
@@ -109,9 +116,6 @@ local function show_formspec(playername, data)
...
@@ -109,9 +116,6 @@ local function show_formspec(playername, data)
"x "
..
(
item
.
attributes
.
in_item
or
"?"
)
..
"x "
..
(
item
.
attributes
.
in_item
or
"?"
)
..
" Stock: "
..
(
item
.
attributes
.
stock
or
"?"
)
" Stock: "
..
(
item
.
attributes
.
stock
or
"?"
)
)
)
if
item
.
attributes
.
stock
==
"0"
then
color
=
"#FF0000"
end
end
elseif
item
.
type
==
"poi"
then
elseif
item
.
type
==
"poi"
then
...
@@ -125,7 +129,14 @@ local function show_formspec(playername, data)
...
@@ -125,7 +129,14 @@ local function show_formspec(playername, data)
-- save description
-- save description
item
.
description
=
description
item
.
description
=
description
list
=
list
..
","
..
color
..
","
..
distance
..
","
..
(
owner
or
"?"
)
..
","
..
coords
..
","
..
description
if
add_to_list
then
list
=
list
..
","
..
color
..
","
..
distance
..
","
..
(
owner
or
"?"
)
..
","
..
coords
..
","
..
description
end
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