Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions src/DialogueEditor/components/Toolbar/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,33 @@ local function Toolbar(props: ToolbarProps)
historyIdentifier = beginHistoryRecording("Add conversation");

local parent = Selection:Get()[1];
if not parent:IsA("Folder") or parent.Name ~= "Conversations" then
local conversationsFolder = if parent then (
if parent:IsA("Folder") and parent.Name == "Conversations" then parent
elseif parent:FindFirstChild("Conversations") and parent:FindFirstChild("Conversations"):IsA("Folder") then parent:FindFirstChild("Conversations")
else nil
) else nil;
if not conversationsFolder then

local newConversationsFolder = Instance.new("Folder");
newConversationsFolder.Name = "Conversations";
newConversationsFolder.Parent = parent;
conversationsFolder = newConversationsFolder;

local conversationsFolder = parent:FindFirstChild("Conversations");
if not conversationsFolder then
end;

local newConversationsFolder = Instance.new("Folder");
newConversationsFolder.Name = "Conversations";
newConversationsFolder.Parent = parent;
conversationsFolder = newConversationsFolder;
assert(conversationsFolder); -- To silence the type checker.

end;
local newContentScript = root.Templates.ConversationTemplate:Clone();
newContentScript.Name = "Conversation";
newContentScript:AddTag("DialogueMakerConversationScript");

parent = conversationsFolder;
if #conversationsFolder:GetChildren() == 0 then

newContentScript:SetAttribute("ShouldAutoTriggerConversation", true);

end;

local newContentScript = root.Templates.ConversationTemplate:Clone();
newContentScript.Name = "Conversation";
newContentScript:AddTag("DialogueMakerConversationScript");
newContentScript.Parent = parent;
newContentScript.Parent = conversationsFolder;

elseif selectedScript then

Expand Down