-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.lua
101 lines (56 loc) · 2.26 KB
/
main.lua
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
require("./data/mods/dda-lua/init")
--[[ Modification code ]]--
local MOD = {
id = "dda-lua-items",
version = "2017-08-13"
}
mods[MOD.id] = MOD
function MOD.on_game_loaded()
LOG.message(MOD.id..".main.on_game_loaded:START")
LOG.message ("You can use `game` global, but cannot use `player` global here.")
LOG.message ("This is run before character selection screen is loaded right after `preload.lua` is executed.")
LOG.message(MOD.id..".main.on_game_loaded:END")
end
function MOD.on_new_player_created()
LOG.message(MOD.id..".main.on_new_player_created:START")
LOG.message ("You can use both `game` and `player` globals here.")
LOG.message ("This is run once when new game is started and player character is created.")
LOG.message ("This is good place for calling MOD.Init() function.")
MOD.Init()
LOG.message(MOD.id..".main.on_new_player_created:END")
end
function MOD.on_skill_increased()
LOG.message(MOD.id..".main.on_skill_increased:START")
LOG.message ("You can use both `game` and `player` globals here.")
LOG.message ("This is run player character skill level increases.")
LOG.message ("This is good place for calling MOD.Update() function.")
MOD.Update()
LOG.message(MOD.id..".main.on_skill_increased:END")
end
function MOD.on_minute_passed()
LOG.message(MOD.id..".main.on_minute_passed:START")
LOG.message ("You can use both `game` and `player` globals here.")
LOG.message ("This is run once per minute.")
LOG.message ("This is good place for calling MOD.Update() function.")
MOD.Update()
LOG.message(MOD.id..".main.on_minute_passed:END")
end
function MOD.on_day_passed()
LOG.message(MOD.id..".main.on_day_passed:START")
LOG.message ("You can use both `game` and `player` globals here.")
LOG.message ("This is run once per minute.")
LOG.message ("This is good place for calling MOD.Update() function.")
MOD.Update()
LOG.message(MOD.id..".main.on_day_passed:END")
end
MOD.Init = function()
LOG.message(MOD.id..".main.Init:START")
LOG.message ("Initialization logic goes here.")
LOG.message(MOD.id..".main.Init:END")
end
MOD.Update = function()
LOG.message(MOD.id..".main.Update:START")
LOG.message ("Update logic goes here.")
LOG.message(MOD.id..".main.Update:END")
end
MOD.on_game_loaded()