Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loud_walking
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
loud_walking
Commits
a380aad8
Commit
a380aad8
authored
8 years ago
by
Duane Robertson
Browse files
Options
Downloads
Patches
Plain Diff
Fix spawns.
parent
60d4f91e
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
chat.lua
+142
-0
142 additions, 0 deletions
chat.lua
mapgen.lua
+29
-9
29 additions, 9 deletions
mapgen.lua
with
171 additions
and
9 deletions
chat.lua
0 → 100644
+
142
−
0
View file @
a380aad8
--minetest.register_chatcommand("armor", {
-- params = "",
-- description = "Display your armor values",
-- privs = {},
-- func = function(player_name, param)
-- if not (player_name and type(player_name) == 'string' and player_name ~= '' and fun_caves.db.status) then
-- return
-- end
--
-- local player = minetest.get_player_by_name(player_name)
-- if not player then
-- return
-- end
--
-- local armor = player:get_armor_groups()
-- if armor then
-- minetest.chat_send_player(player_name, "Armor:")
-- for group, value in pairs(armor) do
-- minetest.chat_send_player(player_name, " "..group.." "..value)
-- end
--
-- if fun_caves.db.status[player_name].armor_elixir then
-- local armor_time = fun_caves.db.status[player_name].armor_elixir.remove
-- local game_time = minetest.get_gametime()
-- if not (armor_time and type(armor_time) == 'number' and game_time and type(game_time) == 'number') then
-- return
-- end
--
-- local min = math.floor(math.max(0, armor_time - game_time) / 60)
-- minetest.chat_send_player(player_name, "Your armor elixir will expire in "..min..' minutes.')
-- end
-- end
-- end,
--})
--minetest.register_chatcommand("setspawn", {
-- params = "",
-- description = "change your spawn position",
-- privs = {},
-- func = function(player_name, param)
-- if not (player_name and type(player_name) == 'string' and player_name ~= '') then
-- return
-- end
--
-- local player = minetest.get_player_by_name(player_name)
-- if not player then
-- return
-- end
--
-- local pos = player:getpos()
-- beds.spawn[player_name] = pos
-- minetest.chat_send_player(player_name, 'Your spawn position has been changed.')
-- end,
--})
minetest
.
register_chatcommand
(
"fixlight"
,
{
params
=
"<radius>"
,
description
=
"attempt to fix light bugs"
,
privs
=
{},
func
=
function
(
player_name
,
param
)
if
not
(
player_name
and
type
(
player_name
)
==
'string'
and
player_name
~=
''
)
then
return
end
local
privs
=
minetest
.
check_player_privs
(
player_name
,
{
server
=
true
})
if
not
privs
then
return
end
print
(
'Loud Walking: '
..
player_name
..
' used the fixlight command'
)
local
player
=
minetest
.
get_player_by_name
(
player_name
)
if
not
player
then
return
end
local
pos
=
player
:
getpos
()
if
not
pos
then
return
end
pos
=
vector
.
round
(
pos
)
local
radius
=
tonumber
(
param
)
or
50
radius
=
math.floor
(
radius
)
local
minp
=
vector
.
subtract
(
pos
,
radius
)
local
maxp
=
vector
.
add
(
pos
,
radius
)
local
vm
=
minetest
.
get_voxel_manip
(
minp
,
maxp
)
if
not
vm
then
return
end
--vm:set_lighting({day = 0, night = 0}, minp, maxp)
vm
:
calc_lighting
(
minp
,
maxp
,
false
)
vm
:
update_liquids
()
vm
:
write_to_map
()
vm
:
update_map
()
end
,
})
--minetest.register_chatcommand("sleep", {
-- params = "",
-- description = "Sleep on the ground",
-- privs = {},
-- func = function(player_name, param)
-- local player = minetest.get_player_by_name(player_name)
-- if not (player and beds) then
-- return
-- end
--
-- if (beds.player and beds.player[player_name]) then
-- minetest.chat_send_player(player_name, 'You can\'t sleep.')
-- return
-- end
--
-- local pos = player:getpos()
-- if not pos then
-- return
-- end
-- pos = vector.round(pos)
--
-- local status, err = pcall(beds.on_rightclick, pos, player)
--
-- if status then
-- minetest.after(5, function()
-- local time = minetest.get_timeofday()
-- if not time or time < 0.23 or time > 0.3 then
-- return
-- end
--
-- local hp = player:get_hp()
-- if hp and type(hp) == 'number' then
-- player:set_hp(hp - 1)
-- end
--
-- minetest.chat_send_player(player_name, 'You\'d sleep better in a bed.')
-- end)
-- end
-- end,
--})
This diff is collapsed.
Click to expand it.
mapgen.lua
+
29
−
9
View file @
a380aad8
...
...
@@ -922,18 +922,38 @@ table.insert(minetest.registered_on_generateds, 1, pgenerate)
function
loud_walking
.
respawn
(
player
)
local
player_name
=
player
:
get_player_name
()
if
not
player_name
then
return
end
if
beds
and
beds
.
spawn
and
beds
.
spawn
[
player_name
]
then
return
end
while
true
do
local
px
=
math.random
(
-
10
,
10
)
*
2
-
1
local
pz
=
math.random
(
-
10
,
10
)
*
2
local
x
=
pod_size
.
x
*
px
local
z
=
pod_size
.
z
*
pz
local
y
=
half_pod
.
y
+
1
local
pos
=
{
x
=
x
,
y
=
y
,
z
=
z
}
local
node
=
minetest
.
get_node
(
pos
)
if
node
.
name
~=
"air"
then
player
:
setpos
(
pos
)
return
true
local
x
=
fcsize
.
x
*
px
+
math.random
(
half_pod
.
x
)
+
math_floor
(
half_pod
.
x
/
2
)
local
z
=
fcsize
.
z
*
pz
+
math.random
(
half_pod
.
z
)
+
math_floor
(
half_pod
.
z
/
2
)
local
y
=
half_pod
.
y
+
5
local
biome
=
get_biome
(
x
,
y
,
z
)
if
biome
then
local
terrain_scale
=
biomes
[
biome
].
terrain_scale
local
noise
=
minetest
.
get_perlin
(
terrain_noise
)
if
not
noise
then
return
end
local
height
=
noise
:
get2d
({
x
=
x
,
y
=
z
})
*
terrain_scale
local
y
=
height
+
half_pod
.
y
+
5
local
pos
=
{
x
=
x
,
y
=
y
,
z
=
z
}
local
node
=
minetest
.
get_node_or_nil
(
pos
)
if
not
node
or
node
.
name
==
'air'
then
player
:
setpos
(
pos
)
return
true
end
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