caillef-pr (#2)
Browse files- update (3e666d453e399d8c31a3ddbf1ca3e3b8c646592c)
- update (6d004c6b053ee01394ff2771bcf67fe7d2619c8b)
- update (fea20a4cecb2fcf89ef6cddb1170a223ec7e9363)
- update (31396ec9eea701b5ecb71a0415ae771c8a91bd4c)
- update (04f22bca6fee470f1620377ae9692904cf019723)
- update (5a5f18ffe726eeddc6b84a7468662ab3229003c6)
- update (a1f3a9a627b5d5c8062dc8a4192717f0b2606514)
- update (3052ab31e45ae1cc3cf84bcc5c331bde1f6fb23b)
- update (d84e910e6219cbf50333c7cc9bc2afd5941e8caf)
- update (89d3cd657caec6dc1d2f628fbecbfc00c3f7bae1)
- update (836dc0796fa8b0b0ad191baf6c11548f0bddb6a0)
- update (c0cc77a32183cdca9cef1bf3d81d683d9ca3c285)
- update (22a9b1b55ba0ff470db8c297e74d1daf759a1a31)
- x (ff0d35a294c2021c359614dc7dd526a8932ab689)
- x (6b8a11d2017ba28ad16018ea4702ecbf99a74be3)
- x (5b12f63a0657a023439cd84a749945e3fd4ee887)
- x (3d3b96f6d595c9dfeef5148d39a98d1fc62fac9e)
- x (664a01fd3eaabcecf59e17169a831c4a54c4af34)
- x (ffe6eaec105e922a48d2cbf44416519ffcef1da9)
- x (f29f54dc072f70cd8b3aefc08ebea59a781e9cc2)
- x (f2816ad32ec59b9a7835578929d3201ce089a04b)
- x (dc115438c575a1bd3b014263a82f29a564bdf7ab)
- x (5589a688c51a1ad699f985146c02ceb9346ed264)
- x (0932888a263884c1be24ccd72c6aef122522b26b)
- x (d0e9bce1897948cf69f3536668d393676bfda438)
- x (5e445136a6dd114d7c09bfeb640175f4216f286b)
- x (a7eab3dcd5218290afb2baa8f8f70390977a4c4f)
- x (c057fe66cd16864bf8de14706ad2643f4c50b866)
- x (755941fa227e755cf4651e498518574b1417cbe4)
- x (b064e25c653af9591a8c9cba271ebbdc3a09d699)
- x (d9c9227bbe5b7a10e682d63327163731c1838a97)
- x (e14d52f10e0366f9dbf8fb7dce1cbf88f2511540)
@@ -1,9 +1,10 @@
|
|
1 |
math.randomseed(math.floor(Time.UnixMilli() % 100000))
|
2 |
|
3 |
Modules = {
|
4 |
-
gigax = "github.com/GigaxGames/integrations/cubzh:
|
5 |
-
pathfinding = "github.com/caillef/cubzh-library/pathfinding:
|
6 |
floating_island_generator = "github.com/caillef/cubzh-library/floating_island_generator:82d22a5",
|
|
|
7 |
}
|
8 |
|
9 |
Config = {
|
@@ -29,8 +30,6 @@ end
|
|
29 |
local SIMULATION_NAME = "Islands" .. tostring(math.random())
|
30 |
local SIMULATION_DESCRIPTION = "Three floating islands."
|
31 |
|
32 |
-
local occupiedPositions = {}
|
33 |
-
|
34 |
local skills = {
|
35 |
{
|
36 |
name = "SAY",
|
@@ -42,8 +41,8 @@ local skills = {
|
|
42 |
print("Can't find npc")
|
43 |
return
|
44 |
end
|
45 |
-
dialog:create(action.content, npc.avatar)
|
46 |
-
print(string.format("%s: %s", npc.
|
47 |
end,
|
48 |
action_format_str = "{protagonist_name} said '{content}' to {target_name}",
|
49 |
},
|
@@ -59,13 +58,13 @@ local skills = {
|
|
59 |
return
|
60 |
end
|
61 |
local npc = client:getNpc(action.character_id)
|
62 |
-
dialog:create("I'm going to " .. targetName, npc.avatar)
|
63 |
-
print(string.format("%s: %s", npc.
|
64 |
local origin = Map:WorldToBlock(npc.object.Position)
|
65 |
local destination = Map:WorldToBlock(targetPosition) + Number3(math.random(-1, 1), 0, math.random(-1, 1))
|
66 |
local canMove = pathfinding:moveObjectTo(npc.object, origin, destination)
|
67 |
if not canMove then
|
68 |
-
dialog:create("I can't go there", npc.avatar)
|
69 |
return
|
70 |
end
|
71 |
end,
|
@@ -82,8 +81,8 @@ local skills = {
|
|
82 |
return
|
83 |
end
|
84 |
|
85 |
-
dialog:create("<Greets you warmly!>", npc.avatar)
|
86 |
-
print(string.format("%s: %s", npc.
|
87 |
|
88 |
npc.avatar.Animations.SwingRight:Play()
|
89 |
end,
|
@@ -100,8 +99,8 @@ local skills = {
|
|
100 |
return
|
101 |
end
|
102 |
|
103 |
-
dialog:create("<Jumps in the air!>", npc.avatar)
|
104 |
-
print(string.format("%s: %s", npc.
|
105 |
|
106 |
npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
|
107 |
npc.object.avatarContainer.Velocity.Y = 50
|
@@ -122,8 +121,8 @@ local skills = {
|
|
122 |
return
|
123 |
end
|
124 |
|
125 |
-
dialog:create("I'm following you", npc.avatar)
|
126 |
-
print(string.format("%s: %s", npc.
|
127 |
|
128 |
followHandler = pathfinding:followObject(npc.object, Player)
|
129 |
return {
|
@@ -147,11 +146,10 @@ local skills = {
|
|
147 |
end
|
148 |
|
149 |
require("explode"):shapes(npc.avatar)
|
150 |
-
dialog:create("*boom*", npc.avatar)
|
151 |
-
--print(string.format("%s: %s", npc.name, "EXPLODING"))
|
152 |
npc.avatar.IsHidden = true
|
153 |
Timer(5, function()
|
154 |
-
dialog:create("Aaaaand... I'm back!", npc.avatar)
|
155 |
npc.avatar.IsHidden = false
|
156 |
end)
|
157 |
end,
|
@@ -170,7 +168,7 @@ local skills = {
|
|
170 |
shape.Scale = 4
|
171 |
Player:EquipRightHand(shape)
|
172 |
|
173 |
-
dialog:create("Here is an apple for you!", npc.avatar)
|
174 |
end,
|
175 |
action_format_str = "{protagonist_name} gave you a piece of bread!"
|
176 |
},
|
@@ -183,7 +181,7 @@ local skills = {
|
|
183 |
if not npc then print("Can't find npc") return end
|
184 |
|
185 |
npc.object.Scale = npc.object.Scale * 2
|
186 |
-
dialog:create("I am taller than you now!", npc.avatar)
|
187 |
end,
|
188 |
action_format_str = "{protagonist_name} doubled his height!"
|
189 |
},--]]
|
@@ -199,12 +197,12 @@ local skills = {
|
|
199 |
end
|
200 |
|
201 |
Object:Load("claire.party_hat", function(obj)
|
202 |
-
require("hierarchyactions"):
|
203 |
o.Physics = PhysicsMode.Disabled
|
204 |
end)
|
205 |
Player:EquipHat(obj)
|
206 |
end)
|
207 |
-
dialog:create("Let's get the party started!", npc.avatar)
|
208 |
end,
|
209 |
action_format_str = "{protagonist_name} gave you a piece of bread!",
|
210 |
},
|
@@ -220,7 +218,7 @@ local skills = {
|
|
220 |
end
|
221 |
|
222 |
local squirrel = spawnSquirrelAbovePlayer(Player)
|
223 |
-
dialog:create("Wooh, squirrel!", npc.avatar)
|
224 |
-- make it disappear after a while
|
225 |
Timer(5, function()
|
226 |
squirrel:RemoveFromParent()
|
@@ -253,6 +251,7 @@ local locations = {
|
|
253 |
local NPCs = {
|
254 |
{
|
255 |
name = "npcscientist",
|
|
|
256 |
physicalDescription = "Short, with a stern expression and sharp eyes",
|
257 |
psychologicalProfile = "Grumpy but insightful, suspicious yet intelligent",
|
258 |
currentLocationName = "Scientist Island",
|
@@ -265,6 +264,7 @@ local NPCs = {
|
|
265 |
},
|
266 |
{
|
267 |
name = "npcbaker",
|
|
|
268 |
physicalDescription = "Tall, with a solemn demeanor and thoughtful eyes",
|
269 |
psychologicalProfile = "Wise and mysterious, calm under pressure",
|
270 |
currentLocationName = "Baker Island",
|
@@ -277,6 +277,7 @@ local NPCs = {
|
|
277 |
},
|
278 |
{
|
279 |
name = "npcpirate",
|
|
|
280 |
physicalDescription = "Average height, with bright green eyes and a warm smile",
|
281 |
psychologicalProfile = "Friendly and helpful, quick-witted and resourceful",
|
282 |
currentLocationName = "Pirate Island",
|
@@ -309,28 +310,33 @@ Client.OnWorldObjectLoad = function(obj)
|
|
309 |
if obj.Name == "pirate_ship" then
|
310 |
obj.Scale = 1
|
311 |
end
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
local pos = obj.Position:Copy()
|
326 |
-
gigaxWorldConfig.
|
327 |
-
gigaxWorldConfig.NPCs[
|
328 |
-
|
|
|
|
|
|
|
329 |
obj:RemoveFromParent()
|
330 |
end
|
331 |
end
|
332 |
|
333 |
Client.OnStart = function()
|
|
|
|
|
334 |
require("object_skills").addStepClimbing(Player, {
|
335 |
mapScale = MAP_SCALE,
|
336 |
collisionGroups = Map.CollisionGroups,
|
@@ -367,7 +373,8 @@ Client.OnStart = function()
|
|
367 |
|
368 |
gigax:setConfig(gigaxWorldConfig)
|
369 |
|
370 |
-
|
|
|
371 |
end
|
372 |
|
373 |
Client.Action1 = function()
|
@@ -406,6 +413,57 @@ Client.OnChat = function(payload)
|
|
406 |
content = msg,
|
407 |
})
|
408 |
|
409 |
-
print(payload.message)
|
410 |
return true
|
411 |
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
math.randomseed(math.floor(Time.UnixMilli() % 100000))
|
2 |
|
3 |
Modules = {
|
4 |
+
gigax = "github.com/GigaxGames/integrations/cubzh:9a71b9f",
|
5 |
+
pathfinding = "github.com/caillef/cubzh-library/pathfinding:5f9c6bd",
|
6 |
floating_island_generator = "github.com/caillef/cubzh-library/floating_island_generator:82d22a5",
|
7 |
+
easy_onboarding = "github.com/caillef/cubzh-library/easy_onboarding:77728ee",
|
8 |
}
|
9 |
|
10 |
Config = {
|
|
|
30 |
local SIMULATION_NAME = "Islands" .. tostring(math.random())
|
31 |
local SIMULATION_DESCRIPTION = "Three floating islands."
|
32 |
|
|
|
|
|
33 |
local skills = {
|
34 |
{
|
35 |
name = "SAY",
|
|
|
41 |
print("Can't find npc")
|
42 |
return
|
43 |
end
|
44 |
+
dialog:create(action.content, npc.avatar.Head)
|
45 |
+
print(string.format("%s: %s", npc.gameName, action.content))
|
46 |
end,
|
47 |
action_format_str = "{protagonist_name} said '{content}' to {target_name}",
|
48 |
},
|
|
|
58 |
return
|
59 |
end
|
60 |
local npc = client:getNpc(action.character_id)
|
61 |
+
dialog:create("I'm going to " .. targetName, npc.avatar.Head)
|
62 |
+
print(string.format("%s: %s", npc.gameName, "I'm going to " .. targetName))
|
63 |
local origin = Map:WorldToBlock(npc.object.Position)
|
64 |
local destination = Map:WorldToBlock(targetPosition) + Number3(math.random(-1, 1), 0, math.random(-1, 1))
|
65 |
local canMove = pathfinding:moveObjectTo(npc.object, origin, destination)
|
66 |
if not canMove then
|
67 |
+
dialog:create("I can't go there", npc.avatar.Head)
|
68 |
return
|
69 |
end
|
70 |
end,
|
|
|
81 |
return
|
82 |
end
|
83 |
|
84 |
+
dialog:create("<Greets you warmly!>", npc.avatar.Head)
|
85 |
+
print(string.format("%s: %s", npc.gameName, "<Greets you warmly!>"))
|
86 |
|
87 |
npc.avatar.Animations.SwingRight:Play()
|
88 |
end,
|
|
|
99 |
return
|
100 |
end
|
101 |
|
102 |
+
dialog:create("<Jumps in the air!>", npc.avatar.Head)
|
103 |
+
print(string.format("%s: %s", npc.gameName, "<Jumps in the air!>"))
|
104 |
|
105 |
npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
|
106 |
npc.object.avatarContainer.Velocity.Y = 50
|
|
|
121 |
return
|
122 |
end
|
123 |
|
124 |
+
dialog:create("I'm following you", npc.avatar.Head)
|
125 |
+
print(string.format("%s: %s", npc.gameName, "I'm following you"))
|
126 |
|
127 |
followHandler = pathfinding:followObject(npc.object, Player)
|
128 |
return {
|
|
|
146 |
end
|
147 |
|
148 |
require("explode"):shapes(npc.avatar)
|
149 |
+
dialog:create("*boom*", npc.avatar.Head)
|
|
|
150 |
npc.avatar.IsHidden = true
|
151 |
Timer(5, function()
|
152 |
+
dialog:create("Aaaaand... I'm back!", npc.avatar.Head)
|
153 |
npc.avatar.IsHidden = false
|
154 |
end)
|
155 |
end,
|
|
|
168 |
shape.Scale = 4
|
169 |
Player:EquipRightHand(shape)
|
170 |
|
171 |
+
dialog:create("Here is an apple for you!", npc.avatar.Head)
|
172 |
end,
|
173 |
action_format_str = "{protagonist_name} gave you a piece of bread!"
|
174 |
},
|
|
|
181 |
if not npc then print("Can't find npc") return end
|
182 |
|
183 |
npc.object.Scale = npc.object.Scale * 2
|
184 |
+
dialog:create("I am taller than you now!", npc.avatar.Head)
|
185 |
end,
|
186 |
action_format_str = "{protagonist_name} doubled his height!"
|
187 |
},--]]
|
|
|
197 |
end
|
198 |
|
199 |
Object:Load("claire.party_hat", function(obj)
|
200 |
+
require("hierarchyactions"):applyToDescendants(obj, { includeRoot = true }, function(o)
|
201 |
o.Physics = PhysicsMode.Disabled
|
202 |
end)
|
203 |
Player:EquipHat(obj)
|
204 |
end)
|
205 |
+
dialog:create("Let's get the party started!", npc.avatar.Head)
|
206 |
end,
|
207 |
action_format_str = "{protagonist_name} gave you a piece of bread!",
|
208 |
},
|
|
|
218 |
end
|
219 |
|
220 |
local squirrel = spawnSquirrelAbovePlayer(Player)
|
221 |
+
dialog:create("Wooh, squirrel!", npc.avatar.Head)
|
222 |
-- make it disappear after a while
|
223 |
Timer(5, function()
|
224 |
squirrel:RemoveFromParent()
|
|
|
251 |
local NPCs = {
|
252 |
{
|
253 |
name = "npcscientist",
|
254 |
+
gameName = "Scientist",
|
255 |
physicalDescription = "Short, with a stern expression and sharp eyes",
|
256 |
psychologicalProfile = "Grumpy but insightful, suspicious yet intelligent",
|
257 |
currentLocationName = "Scientist Island",
|
|
|
264 |
},
|
265 |
{
|
266 |
name = "npcbaker",
|
267 |
+
gameName = "Baker",
|
268 |
physicalDescription = "Tall, with a solemn demeanor and thoughtful eyes",
|
269 |
psychologicalProfile = "Wise and mysterious, calm under pressure",
|
270 |
currentLocationName = "Baker Island",
|
|
|
277 |
},
|
278 |
{
|
279 |
name = "npcpirate",
|
280 |
+
gameName = "Pirate",
|
281 |
physicalDescription = "Average height, with bright green eyes and a warm smile",
|
282 |
psychologicalProfile = "Friendly and helpful, quick-witted and resourceful",
|
283 |
currentLocationName = "Pirate Island",
|
|
|
310 |
if obj.Name == "pirate_ship" then
|
311 |
obj.Scale = 1
|
312 |
end
|
313 |
+
|
314 |
+
local locationsIndexByName = {}
|
315 |
+
for k, v in ipairs(gigaxWorldConfig.locations) do
|
316 |
+
locationsIndexByName[v.name] = k
|
317 |
+
end
|
318 |
+
local npcIndexByName = {
|
319 |
+
NPC_scientist = 1,
|
320 |
+
NPC_baker = 2,
|
321 |
+
NPC_pirate = 3,
|
322 |
+
}
|
323 |
+
|
324 |
+
local index = npcIndexByName[obj.Name]
|
325 |
+
if index then
|
326 |
local pos = obj.Position:Copy()
|
327 |
+
gigaxWorldConfig.NPCs[index].position = pos
|
328 |
+
gigaxWorldConfig.NPCs[index].rotation = obj.Rotation:Copy()
|
329 |
+
|
330 |
+
local locationName = gigaxWorldConfig.NPCs[index].currentLocationName
|
331 |
+
local locationIndex = locationsIndexByName[locationName]
|
332 |
+
gigaxWorldConfig.locations[locationIndex].position = pos
|
333 |
obj:RemoveFromParent()
|
334 |
end
|
335 |
end
|
336 |
|
337 |
Client.OnStart = function()
|
338 |
+
easy_onboarding:startOnboarding(onboardingConfig)
|
339 |
+
|
340 |
require("object_skills").addStepClimbing(Player, {
|
341 |
mapScale = MAP_SCALE,
|
342 |
collisionGroups = Map.CollisionGroups,
|
|
|
373 |
|
374 |
gigax:setConfig(gigaxWorldConfig)
|
375 |
|
376 |
+
local randomNames = { "aduermael", "soliton", "gdevillele", "caillef", "voxels", "petroglyph" }
|
377 |
+
Player.Avatar:load({ usernameOrId = randomNames[math.random(#randomNames)] })
|
378 |
end
|
379 |
|
380 |
Client.Action1 = function()
|
|
|
413 |
content = msg,
|
414 |
})
|
415 |
|
416 |
+
print("User: " .. payload.message)
|
417 |
return true
|
418 |
end
|
419 |
+
|
420 |
+
onboardingConfig = {
|
421 |
+
steps = {
|
422 |
+
{
|
423 |
+
start = function(onboarding)
|
424 |
+
local data = {}
|
425 |
+
data.ui = onboarding:createTextStep("1/3 - Hold click and drag to move the camera.")
|
426 |
+
data.listener = LocalEvent:Listen(LocalEvent.Name.PointerDrag, function()
|
427 |
+
Timer(1, function()
|
428 |
+
onboarding:next()
|
429 |
+
end)
|
430 |
+
data.listener:Remove()
|
431 |
+
end)
|
432 |
+
return data
|
433 |
+
end,
|
434 |
+
stop = function(_, data)
|
435 |
+
data.ui:remove()
|
436 |
+
end,
|
437 |
+
},
|
438 |
+
{
|
439 |
+
start = function(onboarding)
|
440 |
+
local data = {}
|
441 |
+
data.ui = onboarding:createTextStep("2/3 - Use WASD/ZQSD to move.")
|
442 |
+
data.listener = LocalEvent:Listen(LocalEvent.Name.KeyboardInput, function()
|
443 |
+
Timer(1, function()
|
444 |
+
onboarding:next()
|
445 |
+
end)
|
446 |
+
data.listener:Remove()
|
447 |
+
end)
|
448 |
+
|
449 |
+
return data
|
450 |
+
end,
|
451 |
+
stop = function(_, data)
|
452 |
+
data.ui:remove()
|
453 |
+
end,
|
454 |
+
},
|
455 |
+
{
|
456 |
+
start = function(onboarding)
|
457 |
+
local data = {}
|
458 |
+
data.ui = onboarding:createTextStep("3/3 - Press Enter in front of the Pirate to chat.")
|
459 |
+
Timer(10, function()
|
460 |
+
onboarding:next()
|
461 |
+
end)
|
462 |
+
return data
|
463 |
+
end,
|
464 |
+
stop = function(_, data)
|
465 |
+
data.ui:remove()
|
466 |
+
end,
|
467 |
+
},
|
468 |
+
},
|
469 |
+
}
|