Corentin Cailleaud commited on
Commit
c057fe6
1 Parent(s): a7eab3d
Files changed (1) hide show
  1. cubzh.lua +11 -9
cubzh.lua CHANGED
@@ -314,7 +314,7 @@ if IsClient then
314
  gigaxHttpClient:updateCharacterPosition(simulation.engineId, characterId, closest._id, position)
315
  end
316
 
317
- local function createNPC(name, currentPosition, rotation)
318
  -- Create the NPC's Object and Avatar
319
  local NPC = {}
320
  NPC.object = Object()
@@ -333,7 +333,7 @@ if IsClient then
333
  })
334
 
335
  local text = Text()
336
- text.Text = " " .. string.upper(string.sub(name, 4, 4)) .. string.sub(name, 5, #name) .. " "
337
  text:SetParent(NPC.object)
338
  text.Type = TextType.Screen
339
  text.IsUnlit = true
@@ -415,7 +415,7 @@ if IsClient then
415
  elem.onEndCallback = nil
416
  end
417
  for _, elem in ipairs(config.NPCs) do
418
- createNPC(elem.name, elem.position, elem.rotation)
419
  end
420
  registerEngine(config)
421
  end
@@ -454,7 +454,7 @@ local skills = {
454
  return
455
  end
456
  dialog:create(action.content, npc.avatar.Head)
457
- print(string.format("%s: %s", npc.name, action.content))
458
  end,
459
  action_format_str = "{protagonist_name} said '{content}' to {target_name}",
460
  },
@@ -471,7 +471,7 @@ local skills = {
471
  end
472
  local npc = client:getNpc(action.character_id)
473
  dialog:create("I'm going to " .. targetName, npc.avatar.Head)
474
- print(string.format("%s: %s", npc.name, "I'm going to " .. targetName))
475
  local origin = Map:WorldToBlock(npc.object.Position)
476
  local destination = Map:WorldToBlock(targetPosition) + Number3(math.random(-1, 1), 0, math.random(-1, 1))
477
  local canMove = pathfinding:moveObjectTo(npc.object, origin, destination)
@@ -494,7 +494,7 @@ local skills = {
494
  end
495
 
496
  dialog:create("<Greets you warmly!>", npc.avatar.Head)
497
- print(string.format("%s: %s", npc.name, "<Greets you warmly!>"))
498
 
499
  npc.avatar.Animations.SwingRight:Play()
500
  end,
@@ -512,7 +512,7 @@ local skills = {
512
  end
513
 
514
  dialog:create("<Jumps in the air!>", npc.avatar.Head)
515
- print(string.format("%s: %s", npc.name, "<Jumps in the air!>"))
516
 
517
  npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
518
  npc.object.avatarContainer.Velocity.Y = 50
@@ -534,7 +534,7 @@ local skills = {
534
  end
535
 
536
  dialog:create("I'm following you", npc.avatar.Head)
537
- print(string.format("%s: %s", npc.name, "I'm following you"))
538
 
539
  followHandler = pathfinding:followObject(npc.object, Player)
540
  return {
@@ -559,7 +559,6 @@ local skills = {
559
 
560
  require("explode"):shapes(npc.avatar)
561
  dialog:create("*boom*", npc.avatar.Head)
562
- --print(string.format("%s: %s", npc.name, "EXPLODING"))
563
  npc.avatar.IsHidden = true
564
  Timer(5, function()
565
  dialog:create("Aaaaand... I'm back!", npc.avatar.Head)
@@ -664,6 +663,7 @@ local locations = {
664
  local NPCs = {
665
  {
666
  name = "npcscientist",
 
667
  physicalDescription = "Short, with a stern expression and sharp eyes",
668
  psychologicalProfile = "Grumpy but insightful, suspicious yet intelligent",
669
  currentLocationName = "Scientist Island",
@@ -676,6 +676,7 @@ local NPCs = {
676
  },
677
  {
678
  name = "npcbaker",
 
679
  physicalDescription = "Tall, with a solemn demeanor and thoughtful eyes",
680
  psychologicalProfile = "Wise and mysterious, calm under pressure",
681
  currentLocationName = "Baker Island",
@@ -688,6 +689,7 @@ local NPCs = {
688
  },
689
  {
690
  name = "npcpirate",
 
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",
 
314
  gigaxHttpClient:updateCharacterPosition(simulation.engineId, characterId, closest._id, position)
315
  end
316
 
317
+ local function createNPC(name, gameName, currentPosition, rotation)
318
  -- Create the NPC's Object and Avatar
319
  local NPC = {}
320
  NPC.object = Object()
 
333
  })
334
 
335
  local text = Text()
336
+ text.Text = " " .. gameName .. " "
337
  text:SetParent(NPC.object)
338
  text.Type = TextType.Screen
339
  text.IsUnlit = true
 
415
  elem.onEndCallback = nil
416
  end
417
  for _, elem in ipairs(config.NPCs) do
418
+ createNPC(elem.name, elem.gameName, elem.position, elem.rotation)
419
  end
420
  registerEngine(config)
421
  end
 
454
  return
455
  end
456
  dialog:create(action.content, npc.avatar.Head)
457
+ print(string.format("%s: %s", npc.gameName, action.content))
458
  end,
459
  action_format_str = "{protagonist_name} said '{content}' to {target_name}",
460
  },
 
471
  end
472
  local npc = client:getNpc(action.character_id)
473
  dialog:create("I'm going to " .. targetName, npc.avatar.Head)
474
+ print(string.format("%s: %s", npc.gameName, "I'm going to " .. targetName))
475
  local origin = Map:WorldToBlock(npc.object.Position)
476
  local destination = Map:WorldToBlock(targetPosition) + Number3(math.random(-1, 1), 0, math.random(-1, 1))
477
  local canMove = pathfinding:moveObjectTo(npc.object, origin, destination)
 
494
  end
495
 
496
  dialog:create("<Greets you warmly!>", npc.avatar.Head)
497
+ print(string.format("%s: %s", npc.gameName, "<Greets you warmly!>"))
498
 
499
  npc.avatar.Animations.SwingRight:Play()
500
  end,
 
512
  end
513
 
514
  dialog:create("<Jumps in the air!>", npc.avatar.Head)
515
+ print(string.format("%s: %s", npc.gameName, "<Jumps in the air!>"))
516
 
517
  npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
518
  npc.object.avatarContainer.Velocity.Y = 50
 
534
  end
535
 
536
  dialog:create("I'm following you", npc.avatar.Head)
537
+ print(string.format("%s: %s", npc.gameName, "I'm following you"))
538
 
539
  followHandler = pathfinding:followObject(npc.object, Player)
540
  return {
 
559
 
560
  require("explode"):shapes(npc.avatar)
561
  dialog:create("*boom*", npc.avatar.Head)
 
562
  npc.avatar.IsHidden = true
563
  Timer(5, function()
564
  dialog:create("Aaaaand... I'm back!", npc.avatar.Head)
 
663
  local NPCs = {
664
  {
665
  name = "npcscientist",
666
+ gameName = "Scientist",
667
  physicalDescription = "Short, with a stern expression and sharp eyes",
668
  psychologicalProfile = "Grumpy but insightful, suspicious yet intelligent",
669
  currentLocationName = "Scientist Island",
 
676
  },
677
  {
678
  name = "npcbaker",
679
+ gameName = "Baker",
680
  physicalDescription = "Tall, with a solemn demeanor and thoughtful eyes",
681
  psychologicalProfile = "Wise and mysterious, calm under pressure",
682
  currentLocationName = "Baker Island",
 
689
  },
690
  {
691
  name = "npcpirate",
692
+ gameName = "Pirate",
693
  physicalDescription = "Average height, with bright green eyes and a warm smile",
694
  psychologicalProfile = "Friendly and helpful, quick-witted and resourceful",
695
  currentLocationName = "Pirate Island",