-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlimerite.lua
74 lines (51 loc) · 2.13 KB
/
Slimerite.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
PLUGIN = nil
--makes it easier to call the plugin manager
plugin = cPluginManager
const = require("constants")
--Functions
--makes it easier to add a hook
function addhook(Hname, calledfunc)
cPluginManager.AddHook(Hname, calledfunc)
end
function whenSpawned(Player)
Player:SendMessageInfo("Disclaimer: Slimerite is in it's alpha stage. Don't expect much. Now that that's out of the way, Use /SR guide to grab yourself a book!")
end
function oncommand(Split, plr)
if Split[2] == "guide" then LOG(plr:GetInventory():AddItem(cItem(E_ITEM_BOOK,1,0,"","SlimeRite Guide")))
return true
elseif Split[2] == "version" then plr:SendMessageInfo("SlimeRite: v".. PLUGIN:GetVersion())
return true
end
end
--End "outer" Functions
--Occurs on initialization.
function Initialize(Plugin)
Plugin:SetName("SlimeRite")
Plugin:SetVersion(0)
initguide()
-- Hooks
PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that
addhook(plugin.HOOK_PLAYER_JOINED,whenSpawned)
addhook(plugin.HOOK_PLAYER_RIGHT_CLICK,onRClick)
addhook(plugin.HOOK_TAKE_DAMAGE,OnTakeDamage)
--Hooks End
-- Command Bindings = plugin.BindCommand("commandname", "permissionnode", functocall,"description of command and parameters")
plugin.BindCommand("/SR","core.build", oncommand, "It's the SlimeRite main command. /SR guide gives you a guide and /SR version shows the plugin version.")
--Command Bindings End
LOG("Initialised version " .. Plugin:GetVersion())
LOG("Thanks, TheBusyBiscuit for creating the original slimefun!")
LOG("In respect to TBB, here's the link to official SF4: https://github.com/Slimefun/Slimefun4")
return true
end
--For the sake of I don't wanna make this a complicated hellhole, I'm about to use other lua files.
--Also, Ifeel like ruining someone
function OnTakeDamage(Receiver, TDI)
LOG("Damage: Raw ".. TDI.RawDamage .. ", Final:" .. TDI.FinalDamage);
-- If the attacker is a spider, make it deal 999 points of damage (insta-death spiders):
if ((TDI.Attacker ~= nil) and TDI.Attacker:IsA("cWither")) then
TDI.FinalDamage = 15;
end
end
function OnDisable()
LOG("Shutting down SlimeRite")
end