Corentin Cailleaud commited on
Commit ·
bfd6e0e
1
Parent(s): 6ababa9
cubzh.lua
CHANGED
|
@@ -312,7 +312,7 @@ if IsClient then
|
|
| 312 |
gigaxHttpClient:updateCharacterPosition(simulation.engineId, characterId, closest._id, position)
|
| 313 |
end
|
| 314 |
|
| 315 |
-
local function createNPC(name, currentPosition, rotation)
|
| 316 |
-- Create the NPC's Object and Avatar
|
| 317 |
local NPC = {}
|
| 318 |
NPC.object = Object()
|
|
@@ -331,7 +331,7 @@ if IsClient then
|
|
| 331 |
})
|
| 332 |
|
| 333 |
local text = Text()
|
| 334 |
-
text.Text = " " ..
|
| 335 |
text:SetParent(NPC.object)
|
| 336 |
text.Type = TextType.Screen
|
| 337 |
text.IsUnlit = true
|
|
@@ -413,7 +413,7 @@ if IsClient then
|
|
| 413 |
elem.onEndCallback = nil
|
| 414 |
end
|
| 415 |
for _, elem in ipairs(config.NPCs) do
|
| 416 |
-
createNPC(elem.name, elem.position, elem.rotation)
|
| 417 |
end
|
| 418 |
registerEngine(config)
|
| 419 |
end
|
|
@@ -452,7 +452,7 @@ local skills = {
|
|
| 452 |
return
|
| 453 |
end
|
| 454 |
dialog:create(action.content, npc.avatar.Head)
|
| 455 |
-
print(string.format("%s: %s", npc.
|
| 456 |
end,
|
| 457 |
action_format_str = "{protagonist_name} said '{content}' to {target_name}",
|
| 458 |
},
|
|
@@ -469,7 +469,7 @@ local skills = {
|
|
| 469 |
end
|
| 470 |
local npc = client:getNpc(action.character_id)
|
| 471 |
dialog:create("I'm going to " .. targetName, npc.avatar.Head)
|
| 472 |
-
print(string.format("%s: %s", npc.
|
| 473 |
local origin = Map:WorldToBlock(npc.object.Position)
|
| 474 |
local destination = Map:WorldToBlock(targetPosition) + Number3(math.random(-1, 1), 0, math.random(-1, 1))
|
| 475 |
local canMove = pathfinding:moveObjectTo(npc.object, origin, destination)
|
|
@@ -492,7 +492,7 @@ local skills = {
|
|
| 492 |
end
|
| 493 |
|
| 494 |
dialog:create("<Greets you warmly!>", npc.avatar.Head)
|
| 495 |
-
print(string.format("%s: %s", npc.
|
| 496 |
|
| 497 |
npc.avatar.Animations.SwingRight:Play()
|
| 498 |
end,
|
|
@@ -510,7 +510,7 @@ local skills = {
|
|
| 510 |
end
|
| 511 |
|
| 512 |
dialog:create("<Jumps in the air!>", npc.avatar.Head)
|
| 513 |
-
print(string.format("%s: %s", npc.
|
| 514 |
|
| 515 |
npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
|
| 516 |
npc.object.avatarContainer.Velocity.Y = 50
|
|
@@ -532,7 +532,7 @@ local skills = {
|
|
| 532 |
end
|
| 533 |
|
| 534 |
dialog:create("I'm following you", npc.avatar.Head)
|
| 535 |
-
print(string.format("%s: %s", npc.
|
| 536 |
|
| 537 |
followHandler = pathfinding:followObject(npc.object, Player)
|
| 538 |
return {
|
|
@@ -557,7 +557,6 @@ local skills = {
|
|
| 557 |
|
| 558 |
require("explode"):shapes(npc.avatar)
|
| 559 |
dialog:create("*boom*", npc.avatar.Head)
|
| 560 |
-
--print(string.format("%s: %s", npc.name, "EXPLODING"))
|
| 561 |
npc.avatar.IsHidden = true
|
| 562 |
Timer(5, function()
|
| 563 |
dialog:create("Aaaaand... I'm back!", npc.avatar.Head)
|
|
@@ -662,6 +661,7 @@ local locations = {
|
|
| 662 |
local NPCs = {
|
| 663 |
{
|
| 664 |
name = "npcscientist",
|
|
|
|
| 665 |
physicalDescription = "Short, with a stern expression and sharp eyes",
|
| 666 |
psychologicalProfile = "Grumpy but insightful, suspicious yet intelligent",
|
| 667 |
currentLocationName = "Scientist Island",
|
|
@@ -674,6 +674,7 @@ local NPCs = {
|
|
| 674 |
},
|
| 675 |
{
|
| 676 |
name = "npcbaker",
|
|
|
|
| 677 |
physicalDescription = "Tall, with a solemn demeanor and thoughtful eyes",
|
| 678 |
psychologicalProfile = "Wise and mysterious, calm under pressure",
|
| 679 |
currentLocationName = "Baker Island",
|
|
@@ -686,6 +687,7 @@ local NPCs = {
|
|
| 686 |
},
|
| 687 |
{
|
| 688 |
name = "npcpirate",
|
|
|
|
| 689 |
physicalDescription = "Average height, with bright green eyes and a warm smile",
|
| 690 |
psychologicalProfile = "Friendly and helpful, quick-witted and resourceful",
|
| 691 |
currentLocationName = "Pirate Island",
|
|
|
|
| 312 |
gigaxHttpClient:updateCharacterPosition(simulation.engineId, characterId, closest._id, position)
|
| 313 |
end
|
| 314 |
|
| 315 |
+
local function createNPC(name, gameName, currentPosition, rotation)
|
| 316 |
-- Create the NPC's Object and Avatar
|
| 317 |
local NPC = {}
|
| 318 |
NPC.object = Object()
|
|
|
|
| 331 |
})
|
| 332 |
|
| 333 |
local text = Text()
|
| 334 |
+
text.Text = " " .. gameName .. " "
|
| 335 |
text:SetParent(NPC.object)
|
| 336 |
text.Type = TextType.Screen
|
| 337 |
text.IsUnlit = true
|
|
|
|
| 413 |
elem.onEndCallback = nil
|
| 414 |
end
|
| 415 |
for _, elem in ipairs(config.NPCs) do
|
| 416 |
+
createNPC(elem.name, elem.gameName, elem.position, elem.rotation)
|
| 417 |
end
|
| 418 |
registerEngine(config)
|
| 419 |
end
|
|
|
|
| 452 |
return
|
| 453 |
end
|
| 454 |
dialog:create(action.content, npc.avatar.Head)
|
| 455 |
+
print(string.format("%s: %s", npc.gameName, action.content))
|
| 456 |
end,
|
| 457 |
action_format_str = "{protagonist_name} said '{content}' to {target_name}",
|
| 458 |
},
|
|
|
|
| 469 |
end
|
| 470 |
local npc = client:getNpc(action.character_id)
|
| 471 |
dialog:create("I'm going to " .. targetName, npc.avatar.Head)
|
| 472 |
+
print(string.format("%s: %s", npc.gameName, "I'm going to " .. targetName))
|
| 473 |
local origin = Map:WorldToBlock(npc.object.Position)
|
| 474 |
local destination = Map:WorldToBlock(targetPosition) + Number3(math.random(-1, 1), 0, math.random(-1, 1))
|
| 475 |
local canMove = pathfinding:moveObjectTo(npc.object, origin, destination)
|
|
|
|
| 492 |
end
|
| 493 |
|
| 494 |
dialog:create("<Greets you warmly!>", npc.avatar.Head)
|
| 495 |
+
print(string.format("%s: %s", npc.gameName, "<Greets you warmly!>"))
|
| 496 |
|
| 497 |
npc.avatar.Animations.SwingRight:Play()
|
| 498 |
end,
|
|
|
|
| 510 |
end
|
| 511 |
|
| 512 |
dialog:create("<Jumps in the air!>", npc.avatar.Head)
|
| 513 |
+
print(string.format("%s: %s", npc.gameName, "<Jumps in the air!>"))
|
| 514 |
|
| 515 |
npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
|
| 516 |
npc.object.avatarContainer.Velocity.Y = 50
|
|
|
|
| 532 |
end
|
| 533 |
|
| 534 |
dialog:create("I'm following you", npc.avatar.Head)
|
| 535 |
+
print(string.format("%s: %s", npc.gameName, "I'm following you"))
|
| 536 |
|
| 537 |
followHandler = pathfinding:followObject(npc.object, Player)
|
| 538 |
return {
|
|
|
|
| 557 |
|
| 558 |
require("explode"):shapes(npc.avatar)
|
| 559 |
dialog:create("*boom*", npc.avatar.Head)
|
|
|
|
| 560 |
npc.avatar.IsHidden = true
|
| 561 |
Timer(5, function()
|
| 562 |
dialog:create("Aaaaand... I'm back!", npc.avatar.Head)
|
|
|
|
| 661 |
local NPCs = {
|
| 662 |
{
|
| 663 |
name = "npcscientist",
|
| 664 |
+
gameName = "Scientist",
|
| 665 |
physicalDescription = "Short, with a stern expression and sharp eyes",
|
| 666 |
psychologicalProfile = "Grumpy but insightful, suspicious yet intelligent",
|
| 667 |
currentLocationName = "Scientist Island",
|
|
|
|
| 674 |
},
|
| 675 |
{
|
| 676 |
name = "npcbaker",
|
| 677 |
+
gameName = "Baker",
|
| 678 |
physicalDescription = "Tall, with a solemn demeanor and thoughtful eyes",
|
| 679 |
psychologicalProfile = "Wise and mysterious, calm under pressure",
|
| 680 |
currentLocationName = "Baker Island",
|
|
|
|
| 687 |
},
|
| 688 |
{
|
| 689 |
name = "npcpirate",
|
| 690 |
+
gameName = "Pirate",
|
| 691 |
physicalDescription = "Average height, with bright green eyes and a warm smile",
|
| 692 |
psychologicalProfile = "Friendly and helpful, quick-witted and resourceful",
|
| 693 |
currentLocationName = "Pirate Island",
|