yes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/out
|
/out
|
||||||
|
copy.cmd
|
||||||
7
aftman.toml
Normal file
7
aftman.toml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This file lists tools managed by Aftman, a cross-platform toolchain manager.
|
||||||
|
# For more information, see https://github.com/LPGhatguy/aftman
|
||||||
|
|
||||||
|
# To add a new tool, add an entry to this table.
|
||||||
|
[tools]
|
||||||
|
rojo = "rojo-rbx/rojo@7.5.1"
|
||||||
|
# rojo = "rojo-rbx/rojo@6.2.0"
|
||||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -8,6 +8,9 @@
|
|||||||
"name": "next_station_plugin",
|
"name": "next_station_plugin",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@rbxts/signal": "^1.1.1"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rbxts/compiler-types": "^3.0.0-types.0",
|
"@rbxts/compiler-types": "^3.0.0-types.0",
|
||||||
"@rbxts/types": "^1.0.881",
|
"@rbxts/types": "^1.0.881",
|
||||||
@@ -318,6 +321,12 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@rbxts/signal": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rbxts/signal/-/signal-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-WX+ONE+ld4pG9PvRkR8OgDld9NpaV1RfXyUIw+Q2oXP/5rehkYzvt20NWtrLAP3NhMc5inYInLd+hnufey6nFw==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/@rbxts/types": {
|
"node_modules/@rbxts/types": {
|
||||||
"version": "1.0.881",
|
"version": "1.0.881",
|
||||||
"resolved": "https://registry.npmjs.org/@rbxts/types/-/types-1.0.881.tgz",
|
"resolved": "https://registry.npmjs.org/@rbxts/types/-/types-1.0.881.tgz",
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rbxtsc",
|
"build": "rbxtsc",
|
||||||
"watch": "rbxtsc -w"
|
"watch": "rbxtsc -w",
|
||||||
|
"build-to-roblox": "rbxtsc && rojo build --plugin \"next-station.rbxm\""
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
@@ -23,5 +24,8 @@
|
|||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"roblox-ts": "^3.0.0",
|
"roblox-ts": "^3.0.0",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@rbxts/signal": "^1.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Signal from "@rbxts/signal";
|
import Signal from "@rbxts/signal";
|
||||||
import { createAnchor } from "Utils/Gui";
|
import { createAnchor } from "Utils/Gui";
|
||||||
|
import { roundVector } from "Utils/Math";
|
||||||
|
|
||||||
export class Handles {
|
export class Handles {
|
||||||
currentVector: Vector3 = new Vector3();
|
currentVector: Vector3 = new Vector3();
|
||||||
@@ -40,7 +41,7 @@ export class Handles {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.anchor.Position = this.currentVector.add(offset);
|
this.anchor.Position = roundVector(this.currentVector.add(offset));
|
||||||
});
|
});
|
||||||
|
|
||||||
handles.MouseButton1Up.Connect(() => {
|
handles.MouseButton1Up.Connect(() => {
|
||||||
|
|||||||
35
src/Toolbar/Buttons.ts
Normal file
35
src/Toolbar/Buttons.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
const Selection = game.GetService("Selection");
|
||||||
|
const ChangeHistoryService = game.GetService("ChangeHistoryService");
|
||||||
|
|
||||||
|
export function createNewRoomButton(toolbar: PluginToolbar) {
|
||||||
|
const newRoomButton = toolbar.CreateButton("New Room", "New Room", "rbxassetid://14978048121");
|
||||||
|
newRoomButton.Click.Connect(function () {
|
||||||
|
const selectedObjects = Selection.Get();
|
||||||
|
if (selectedObjects.isEmpty()) return;
|
||||||
|
const room = selectedObjects[0];
|
||||||
|
if (!room.IsA("Model")) return;
|
||||||
|
const config = new Instance("Configuration");
|
||||||
|
config.Name = "RoomConfig";
|
||||||
|
config.Parent = room;
|
||||||
|
|
||||||
|
const origin = new Instance("Vector3Value");
|
||||||
|
origin.Name = "Origin";
|
||||||
|
origin.Parent = config;
|
||||||
|
origin.Value = room.GetPivot().Position;
|
||||||
|
|
||||||
|
const endvalue = new Instance("Vector3Value");
|
||||||
|
endvalue.Name = "End";
|
||||||
|
endvalue.Parent = config;
|
||||||
|
endvalue.Value = room.GetPivot().Position;
|
||||||
|
|
||||||
|
const roomtype = new Instance("StringValue");
|
||||||
|
roomtype.Name = "RoomType";
|
||||||
|
roomtype.Parent = config;
|
||||||
|
|
||||||
|
const roomId = new Instance("IntValue");
|
||||||
|
roomId.Name = "RoomId";
|
||||||
|
roomId.Parent = config;
|
||||||
|
|
||||||
|
ChangeHistoryService.SetWaypoint("Added new room config");
|
||||||
|
});
|
||||||
|
}
|
||||||
3
src/Utils/Math.ts
Normal file
3
src/Utils/Math.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export function roundVector(vector: Vector3) {
|
||||||
|
return new Vector3(math.round(vector.X * 4) / 4, math.round(vector.Y * 4) / 4, math.round(vector.Z * 4) / 4);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
type RoomConfig = Configuration & {
|
export type RoomConfig = Configuration & {
|
||||||
RoomId: IntValue;
|
RoomId: IntValue;
|
||||||
RoomType: StringValue;
|
RoomType: StringValue;
|
||||||
Origin: Vector3Value;
|
Origin: Vector3Value;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import LabeledTextInput from "Lualibs/LabeledTextInput";
|
|||||||
import VerticallyScalingListFrame from "Lualibs/VerticallyScalingListFrame";
|
import VerticallyScalingListFrame from "Lualibs/VerticallyScalingListFrame";
|
||||||
import VerticalScrollingFrame from "Lualibs/VerticalScrollingFrame";
|
import VerticalScrollingFrame from "Lualibs/VerticalScrollingFrame";
|
||||||
import { syncGuiColors } from "Utils/Gui";
|
import { syncGuiColors } from "Utils/Gui";
|
||||||
|
import { RoomConfig } from "Utils/Room";
|
||||||
|
|
||||||
export class RoomWidget {
|
export class RoomWidget {
|
||||||
plugin: Plugin;
|
plugin: Plugin;
|
||||||
@@ -64,7 +65,11 @@ export class RoomWidget {
|
|||||||
|
|
||||||
// Setup Widget
|
// Setup Widget
|
||||||
this.roomIdInput.GetFrame().Parent = this.roomCollapse.GetContentsFrame();
|
this.roomIdInput.GetFrame().Parent = this.roomCollapse.GetContentsFrame();
|
||||||
|
const textbox = this.roomIdInput.GetFrame().FindFirstChildOfClass("TextBox")!;
|
||||||
|
textbox.ClearTextOnFocus = false;
|
||||||
this.roomTypeInput.GetFrame().Parent = this.roomCollapse.GetContentsFrame();
|
this.roomTypeInput.GetFrame().Parent = this.roomCollapse.GetContentsFrame();
|
||||||
|
const textboxf = this.roomTypeInput.GetFrame().FindFirstChildOfClass("TextBox")!;
|
||||||
|
textboxf.ClearTextOnFocus = false;
|
||||||
this.listFrame.AddChild(this.roomCollapse.GetSectionFrame());
|
this.listFrame.AddChild(this.roomCollapse.GetSectionFrame());
|
||||||
this.listFrame.AddChild(this.exitCollapse.GetSectionFrame());
|
this.listFrame.AddChild(this.exitCollapse.GetSectionFrame());
|
||||||
|
|
||||||
@@ -74,8 +79,11 @@ export class RoomWidget {
|
|||||||
this.scrollFrame.GetSectionFrame().Parent = this.widget;
|
this.scrollFrame.GetSectionFrame().Parent = this.widget;
|
||||||
this.noRoomLabel.Parent = this.widget;
|
this.noRoomLabel.Parent = this.widget;
|
||||||
}
|
}
|
||||||
UpdateValue() {
|
UpdateValue(config: RoomConfig) {
|
||||||
|
this.roomIdValue = config.RoomId;
|
||||||
|
this.roomIdInput.SetValue(tostring(config.RoomId.Value));
|
||||||
|
this.roomTypeValue = config.RoomType;
|
||||||
|
this.roomTypeInput.SetValue(config.RoomType.Value);
|
||||||
}
|
}
|
||||||
SetActive(active: boolean) {
|
SetActive(active: boolean) {
|
||||||
this.noRoomLabel.Visible = !active;
|
this.noRoomLabel.Visible = !active;
|
||||||
|
|||||||
@@ -1,37 +1,33 @@
|
|||||||
import Signal from "@rbxts/signal";
|
import Signal from "@rbxts/signal";
|
||||||
import { HandlesArea } from "Adornment/Area";
|
import { HandlesArea } from "Adornment/Area";
|
||||||
|
import { createNewRoomButton } from "Toolbar/Buttons";
|
||||||
import { WidgetButton } from "Toolbar/WidgetButton";
|
import { WidgetButton } from "Toolbar/WidgetButton";
|
||||||
import { checkRoomConfig } from "Utils/Room";
|
import { checkRoomConfig } from "Utils/Room";
|
||||||
|
import { RoomWidget } from "Widget/RoomWidget";
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
const Selection = game.GetService("Selection");
|
const Selection = game.GetService("Selection");
|
||||||
const CoreGui = game.GetService("CoreGui");
|
const CoreGui = game.GetService("CoreGui");
|
||||||
|
|
||||||
// Module
|
|
||||||
// const UseLessModule = require(script.Parent.Tools.Useless)
|
|
||||||
// const RoomWidget = require(script.Parent.Widget.Room.Main)
|
|
||||||
// const WidgetButton = require(script.Parent.Widget.WidgetTogger)
|
|
||||||
// const ToolsButtons = require(script.Parent.Buttons.ToolsButtons)
|
|
||||||
|
|
||||||
// Create Widget
|
|
||||||
// const roomWidget = RoomWidget.new(plugin)
|
|
||||||
|
|
||||||
// Create Toolbar
|
|
||||||
const toolbar = plugin.CreateToolbar("Next Station Plugin");
|
|
||||||
|
|
||||||
// Create Buttons
|
|
||||||
// const roomWidgetButton = new WidgetButton(toolbar, roomWidget.widget, "Room Info", "rbxassetid.//14978048121");
|
|
||||||
// const createRoomButton = ToolsButtons.createNewRoomButton(toolbar)
|
|
||||||
|
|
||||||
// Create CoreGui Folders
|
// Create CoreGui Folders
|
||||||
const pluginModel = new Instance("Folder");
|
const pluginModel = new Instance("Folder");
|
||||||
pluginModel.Name = "_constGizmoContainer";
|
pluginModel.Name = "_Model";
|
||||||
pluginModel.Parent = CoreGui;
|
pluginModel.Parent = CoreGui;
|
||||||
|
|
||||||
plugin.Unloading.Connect(() => {
|
plugin.Unloading.Connect(() => {
|
||||||
pluginModel.Destroy();
|
pluginModel.Destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create Widget
|
||||||
|
const roomWidget = new RoomWidget(plugin, pluginModel);
|
||||||
|
|
||||||
|
// Create Toolbar
|
||||||
|
const toolbar = plugin.CreateToolbar("Next Station Plugin");
|
||||||
|
|
||||||
|
// Create Buttons
|
||||||
|
new WidgetButton(toolbar, roomWidget.widget, "Room Info", "rbxassetid//14978048121");
|
||||||
|
createNewRoomButton(toolbar);
|
||||||
|
|
||||||
// Selection Room Config Controller
|
// Selection Room Config Controller
|
||||||
function clearAdornment() {
|
function clearAdornment() {
|
||||||
pluginModel.ClearAllChildren();
|
pluginModel.ClearAllChildren();
|
||||||
@@ -42,14 +38,17 @@ function clearAdornment() {
|
|||||||
const selectedObjects = Selection.Get();
|
const selectedObjects = Selection.Get();
|
||||||
// Reset Adornments
|
// Reset Adornments
|
||||||
clearAdornment();
|
clearAdornment();
|
||||||
|
roomWidget.SetActive(false);
|
||||||
// roomWidget.SetActive(false)
|
// roomWidget.SetActive(false)
|
||||||
if (!selectedObjects.isEmpty()) {
|
if (!selectedObjects.isEmpty()) {
|
||||||
const selected = selectedObjects[0];
|
const selected = selectedObjects[0];
|
||||||
const config = selected.FindFirstChild("RoomConfig");
|
const config = selected.FindFirstChild("RoomConfig");
|
||||||
if (selected.IsA("Model") && config && checkRoomConfig(config)) {
|
if (selected.IsA("Model") && config && checkRoomConfig(config)) {
|
||||||
|
roomWidget.UpdateValue(config);
|
||||||
|
roomWidget.SetActive(true);
|
||||||
const roomArea = new HandlesArea(pluginModel, config.Origin.Value, config.End.Value);
|
const roomArea = new HandlesArea(pluginModel, config.Origin.Value, config.End.Value);
|
||||||
roomArea.originValueChanged.Connect((value) => (config.Origin.Value = value));
|
roomArea.originValueChanged.Connect((value: Vector3) => (config.Origin.Value = value));
|
||||||
roomArea.tipValueChanged.Connect((value) => (config.End.Value = value));
|
roomArea.tipValueChanged.Connect((value: Vector3) => (config.End.Value = value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user