- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.lua
More file actions
Latest commit
45 lines (39 loc) · 1.33 KB
/
Copy pathmod.lua
File metadata and controls
45 lines (39 loc) · 1.33 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
--this is my mod_id
MOD_NAME="devmodeplus"
-- checks for button function
disabled_on_load=false
turned_on=false
seconds_passed=0
functionregister()
return {
name=MOD_NAME,
hooks= {"clock"},
modules= {"command_register", "commands", "helpers"}
}
end
functioninit()
api_library_add_book("devmode_button", "toggle_devmode", "sprites/button.png")
register_commands() --modules/command_register.lua
return"Success"
end
-- Called by the devmode button when pressed
functiontoggle_devmode()
ifturned_on==falsethen
api_set_devmode(true)
turned_on=true
api_log("dev_mode", "Enabled! use '/' to start typing commands. Use /help for a list of known commands!")
else
api_set_devmode(false)
turned_on=false
api_log("dev_mode", "Disabled!")
end
end
functionclock()
-- Keep track of time :)
seconds_passed=seconds_passed+1
-- Makes sure that devmode is disabled after the first game second so that the button can turn it off and on correctly.
ifdisabled_on_load==falsethen
api_set_devmode(false) -- If you want devmode to be on when you load up a new world without needing to press the button, change this to true (note that the button will lie when pressed)
disabled_on_load=true
end
end