Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kif_custom
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
kif_custom
Commits
baa44b92
Commit
baa44b92
authored
4 years ago
by
Peter Nerlich
Browse files
Options
Downloads
Patches
Plain Diff
death marker
adopted from
https://github.com/pandorabox-io/pandorabox_custom/blob/master/death.lua
parent
c33c1bb1
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
death.lua
+42
-0
42 additions, 0 deletions
death.lua
init.lua
+3
-0
3 additions, 0 deletions
init.lua
with
45 additions
and
0 deletions
death.lua
0 → 100644
+
42
−
0
View file @
baa44b92
-- adopted from https://github.com/pandorabox-io/pandorabox_custom/blob/master/death.lua
local
BONES_WAYPOINT_EXPIRES_SECONDS
=
42
*
60
minetest
.
register_on_dieplayer
(
function
(
player
)
local
player_name
=
player
:
get_player_name
()
local
pos
=
player
:
get_pos
()
pos
.
x
=
math.floor
(
pos
.
x
+
0
.
5
)
pos
.
y
=
math.floor
(
pos
.
y
+
0
.
5
)
pos
.
z
=
math.floor
(
pos
.
z
+
0
.
5
)
local
pos_string
=
minetest
.
pos_to_string
(
pos
)
minetest
.
log
(
"action"
,
"[death] player '"
..
player_name
..
"' died at "
..
pos_string
)
minetest
.
chat_send_player
(
player_name
,
"You died at "
..
pos_string
)
local
bone_string
=
"Bones"
if
player
.
get_attribute
then
-- [xp_redo] keeps track of deathcount, let's see if it is there
local
count
=
player
:
get_attribute
(
"died"
)
if
count
then
bone_string
=
"Bone #"
..
tostring
(
count
)
end
end
-- if not fake player
local
hud_id
=
player
:
hud_add
({
hud_elem_type
=
"waypoint"
,
name
=
bone_string
..
" "
..
pos_string
,
text
=
"m"
,
number
=
0xFFFFFF
,
world_pos
=
pos
})
minetest
.
after
(
BONES_WAYPOINT_EXPIRES_SECONDS
,
function
()
-- retrieve player by name, the "player" object should not be carried across server-steps
player
=
minetest
.
get_player_by_name
(
player_name
)
if
player
then
player
:
hud_remove
(
hud_id
)
end
end
)
end
)
This diff is collapsed.
Click to expand it.
init.lua
+
3
−
0
View file @
baa44b92
...
...
@@ -19,5 +19,8 @@ end
-- /spawn command
dofile
(
MP
..
"/chat/spawn.lua"
)
-- death message
dofile
(
MP
..
"/death.lua"
)
-- by popular demand
dofile
(
MP
..
"/additional_stuff/salad_pickaxe.lua"
)
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