-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisguises.lua
More file actions
99 lines (91 loc) · 4.89 KB
/
disguises.lua
File metadata and controls
99 lines (91 loc) · 4.89 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
87
88
89
90
91
92
93
94
95
96
97
98
99
-- disguises.lua
-- Handles disguise-related commands and their implementation.
function HandleDisguiseCommand(Split, Player)
if Split[2] == nil then
Player:SendMessageInfo(cChatColor.LightGray .. "Usage: "..Split[1].." <entity[:baby]> [name]")
-- Player:SendMessageInfo("Available types: arrow, bat, blaze, boat, cavespider, chicken, cow, creeper, egg, enderdragon, enderman, enderpearl, expbottle, fireball, firecharge, ghast, giant, guardian, horse, irongolem, magmacube, minecart, minecartchest, minecartfurnace, minecarthopper, minecarttnt, mooshroom, ocelot, pig, rabbit, sheep, silverfish, skeleton, slime, snowball, snowgolem, spider, splashpotion, squid, villager, witch, wither, witherskull, wolf, zombie, zombiepigman")
else
local IsBaby = false
local EntityString = string.lower(Split[2])
if string.find(EntityString, ":") then
EntityString, data = string.match(EntityString, "(%w+):(%w+)")
if data == "baby" then
IsBaby = true
end
end
local MobType = cMonster:StringToMobType(EntityString)
local World = Player:GetWorld()
local X = Player:GetPosX() + 1.1
local Y = Player:GetPosY()
local Z = Player:GetPosZ() + 1.1
local Origin = Player:GetEquippedItem()
local Speed = Vector3d():Move(0, 0, 0)
if MobType ~= mtInvalidType or EntityString == "arrow" or EntityString == "boat" or EntityString == "egg" or EntityString == "enderpearl" or EntityString == "expbottle" or EntityString == "fireball" or EntityString == "firecharge" or EntityString == "minecart" or EntityString == "minecartchest" or EntityString == "minecartfurnace" or EntityString == "minecarthopper" or EntityString == "minecarttnt" or EntityString == "snowball" or EntityString == "splashpotion" or EntityString == "witherskull" then
if DisguiseFor[Player:GetUUID()] ~= nil then
Player:GetWorld():DoWithEntityByID(DisguiseFor[Player:GetUUID()], cEntity.Destroy)
end
end
if EntityString == "arrow" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 60, Player, Origin, Speed)
elseif EntityString == "boat" then
DisguiseFor[Player:GetUUID()] = World:SpawnBoat(Vector3d(X + 0.1, Y, Z + 0.1), cBoat.bmOak)
elseif EntityString == "egg" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 62, Player, Origin, Speed)
elseif EntityString == "enderpearl" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 65, Player, Origin, Speed)
elseif EntityString == "expbottle" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 75, Player, Origin, Speed)
elseif EntityString == "fireball" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 63, Player, Origin, Speed)
elseif EntityString == "firecharge" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 64, Player, Origin, Speed)
elseif EntityString == "giant" or EntityString == "ghast" then
DisguiseFor[Player:GetUUID()] = World:SpawnMob(X + 1.5, Y, Z + 1.5, MobType, IsBaby)
elseif EntityString == "minecart" then
DisguiseFor[Player:GetUUID()] = World:SpawnMinecart(X, Y, Z, 328)
elseif EntityString == "minecartchest" then
DisguiseFor[Player:GetUUID()] = World:SpawnMinecart(X, Y, Z, 342)
elseif EntityString == "minecartfurnace" then
DisguiseFor[Player:GetUUID()] = World:SpawnMinecart(X, Y, Z, 343)
elseif EntityString == "minecarthopper" then
DisguiseFor[Player:GetUUID()] = World:SpawnMinecart(X, Y, Z, 408)
elseif EntityString == "minecarttnt" then
DisguiseFor[Player:GetUUID()] = World:SpawnMinecart(X, Y, Z, 407)
elseif EntityString == "snowball" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 61, Player, Origin, Speed)
elseif EntityString == "splashpotion" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 73, Player, Origin, Speed)
elseif EntityString == "witherskull" then
DisguiseFor[Player:GetUUID()] = World:CreateProjectile(X, Y, Z, 66, Player, Origin, Speed)
elseif MobType ~= mtInvalidType then
DisguiseFor[Player:GetUUID()] = World:SpawnMob(X, Y, Z, MobType, IsBaby)
else
Player:SendMessageFailure("Could not find that entity (" .. Split[2] .. ").")
return true
end
if MobType ~= mtInvalidType then
Player:GetWorld():DoWithEntityByID(
DisguiseFor[Player:GetUUID()],
function(Entity)
Entity:SetCustomName(table.concat( Split , " " , 3 ))
end
)
end
local StartsWith = string.sub(EntityString, 1, 1)
if StartsWith == "e" or StartsWith == "i" or StartsWith == "o" then
Player:SendMessageSuccess("Disguised you as an " .. EntityString .. ".")
else
Player:SendMessageSuccess("Disguised you as a " .. EntityString .. ".")
end
end
return true
end
function HandleRevealCommand(Split, Player)
if DisguiseFor[Player:GetUUID()] ~= nil then
DestroyDisguise(Player)
Player:SendMessageSuccess("Removed the disguise from your player.")
else
Player:SendMessageFailure("Could not find a disguise to remove.")
end
return true
end