-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinit.lua
More file actions
86 lines (72 loc) · 1.94 KB
/
Copy pathinit.lua
File metadata and controls
86 lines (72 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
local modname = core.get_current_modname()
local modpath = core.get_modpath(modname)
local S = core.get_translator(modname)
emote = {
modname = modname,
modpath = modpath,
S = S,
log = function(level, messagefmt, ...)
return core.log(level, ("[%s] %s"):format(modname, messagefmt:format(...)))
end,
dofile = function(...)
return dofile(table.concat({ modpath, ... }, DIR_DELIM) .. ".lua")
end,
}
emote.dofile("settings")
emote.dofile("util")
emote.dofile("api")
emote.dofile("entity")
local model = player_api.registered_models["character.b3d"]
emote.register_emote("stand", {
anim_name = "stand",
speed = 30,
description = S("stands up")
})
emote.register_emote("sit", {
anim_name = "sit",
speed = 30,
description = S("sits"),
})
emote.register_emote("lay", {
anim_name = "lay",
speed = 30,
description = S("lies down"),
})
emote.register_emote("sleep", { -- alias for lay
anim_name = "lay",
speed = 30,
description = S("falls asleep"),
})
model.animations.wave = { x = 192, y = 196, override_local = true }
emote.register_emote("wave", {
anim_name = "wave",
speed = 15,
stop_after = 4,
description = S("waves")
})
model.animations.point = { x = 196, y = 196, override_local = true }
emote.register_emote("point", {
anim_name = "point",
speed = 30,
description = S("points")
})
model.animations.freeze = { x = 205, y = 205, override_local = true }
emote.register_emote("freeze", {
anim_name = "freeze",
speed = 30,
description = S("freezes")
})
--[[
-- testing tool - punch any node to test attachment code
]]
--
core.register_tool("emote:sleep", {
description = "use me on a bed bottom",
groups = { not_in_creative_inventory = 1 },
on_use = function(itemstack, user, pointed_thing)
-- the delay here is weird, but the client receives a mouse-up event
-- after the punch and switches back to "stand" animation, undoing
-- the animation change we're doing.
core.after(0.5, emote.attach_to_node, user, pointed_thing.under)
end
})