1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-15 23:10:31 +01:00

[cozy] Add cozy mod

- For #405
This commit is contained in:
LeMagnesium 2016-03-05 15:03:10 +01:00
parent b40a199104
commit 5b926f753c
6 changed files with 59 additions and 0 deletions

3
mods/cozy/README Normal file
View File

@ -0,0 +1,3 @@
Description: Adds commands to /lay or /sit.
License: WTFPL
Depends: default

1
mods/cozy/depends.txt Normal file
View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1 @@
Sit and lay using chat commands

53
mods/cozy/init.lua Normal file
View File

@ -0,0 +1,53 @@
minetest.register_globalstep(function(dtime)
local players = minetest.get_connected_players()
for i=1, #players do
local name = players[i]:get_player_name()
if default.player_attached[name] and not players[i]:get_attach() and
(players[i]:get_player_control().up == true or
players[i]:get_player_control().down == true or
players[i]:get_player_control().left == true or
players[i]:get_player_control().right == true or
players[i]:get_player_control().jump == true) then
players[i]:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
players[i]:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(players[i], "stand", 30)
end
end
end)
minetest.register_chatcommand("sit", {
description = "Sit down",
func = function(name)
local player = minetest.get_player_by_name(name)
if default.player_attached[name] then
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
player:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(player, "stand", 30)
else
player:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0)
default.player_attached[name] = true
default.player_set_animation(player, "sit", 30)
end
end
})
minetest.register_chatcommand("lay", {
description = "Lay down",
func = function(name)
local player = minetest.get_player_by_name(name)
if default.player_attached[name] then
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
player:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(player, "stand", 30)
else
player:set_eye_offset({x=0, y=-13, z=0}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0)
default.player_attached[name] = true
default.player_set_animation(player, "lay", 0)
end
end
})

BIN
mods/cozy/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -156,6 +156,7 @@ load_mod_solarmana = true
load_mod_runes = false load_mod_runes = false
load_mod_broomstick = true load_mod_broomstick = true
load_mod_fail = true load_mod_fail = true
load_mod_cozy = true
load_mod_unified_inventory = true load_mod_unified_inventory = true
load_mod_inventory_icon = true load_mod_inventory_icon = true