-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfubotspawner.lua
92 lines (81 loc) · 1.7 KB
/
fubotspawner.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
item =
{
parameters= {
tooltipFields= {
subtitle= "",
objectImage= {
}
},
podUuid=nil,
description="",
podItemHasPriority= false,
pets=
{
{
description="",
collisionPoly= {
{-1.75, 2.55},
{-2.25, 2.05},
{-2.75, -3.55},
{-2.25, -3.95},
{2.25, -3.95},
{2.75, -3.55},
{2.25, 2.05},
{1.75, 2.55}
},
name= "",
portrait= {
},
config= {
parameters= {
aggressive= true,
level= 1,
familyIndex= 0,
seed= "0"
},
type= ""
}
}
}
},
name= "botpod",
count= 1
}
function loadMonster()
local botspawner=config.getParameter("botspawner")
if not botspawner then return false end
if not botspawner.type then return false end
local name=config.getParameter("shortdescription") or "Broken Bot"
local desc=config.getParameter("description") or "Yup, you broke it."
local imgData=root.monsterPortrait(botspawner.type)
local monsterData=root.monsterParameters(botspawner.type)
item.parameters.tooltipFields.subtitle=name
item.parameters.description=desc
item.parameters.tooltipFields.objectImage=imgData
local buffer={}
for _,pet in pairs(item.parameters.pets) do
pet.description=desc
pet.name=name
pet.portrait=imgData
pet.collisionPoly=monsterData.movementSettings.collisionPoly
pet.config.type=botspawner.type
table.insert(buffer,pet)
end
item.parameters.pets=buffer
return true
end
function printMonster()
item.parameters.podUuid=sb.makeUuid()
if world.spawnItem(item,entity.position()) then
object.setInteractive(false)
object.smash(true)
end
end
function init()
object.setInteractive(true)
end
function onInteraction()
if loadMonster() then
printMonster()
end
end