diff --git a/README.md b/README.md index 1129356..bd67237 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # p94-ts -An unfinished, broken game (in typescript!) \ No newline at end of file +An unfinished, broken "game" (that I am trying to rewrite in typescript!) + +This is a Rojo project. You can build and serve it like a Rojo project if you have Roblox-ts installed. However, I cannot guarantee that it will actually work. diff --git a/src/server/main.server.ts b/src/server/main.server.ts index a53c476..3fa4418 100644 --- a/src/server/main.server.ts +++ b/src/server/main.server.ts @@ -188,10 +188,7 @@ var p: {[key: number]: pEntry} = []; // The god table. Legend says it holds the function initPlr(plr: Player) { let uId = plr.UserId; // PLAYER VARIABLES - let parts = getParts(uId); - if (!parts) { warn("Server: Player by UserId of " + tS(uId) + " not found, returning..."); return; } // One last chance to turn back - let wings = makeWings(parts); // From here, we are nihilists (if the thread errors, it errors) - makeDecor(wings, "SpectrumWing", "SpectrumCore") + let chrInfo = setUp(uId) let entry: pEntry = { // This should load information from datastores in the future set = 1, mode = "Q", @@ -203,9 +200,10 @@ function initPlr(plr: Player) { pvp = false, mousePos = new v3 (0,0,0), - parts = parts, - wings = wings, + parts = chrInfo[1], + wings = chrInfo[2], }; + //guh.StoredModeInfo = {} //PlaybackLoudness information //guh.PBL = Instance.new("NumberValue",plr) @@ -216,7 +214,7 @@ function initPlr(plr: Player) { //pvp[uId] = 0 //Zero is none, one is friends, two is all. //Finish setup p[uId] = entry; - setUp(plr); // TEMPORARY + //setUp(plr); // TEMPORARY //plr.CharacterAdded.Connect(setUp) /* WILL BE REIMPLEMENTED WITH THE SGANIMATE REWORK @@ -352,25 +350,29 @@ function makeDecor(wings: [undefined?, Folder, Part[][], Part], wing: string,cor } function makeBGui() { - let gui = new inst("BillboardGui")//game.ServerStorage.StarG:Clone() + let gui = new inst("BillboardGui");//game.ServerStorage.StarG:Clone() + //let BGui: [undefined?, BillboardGui, TextLabel, TextLabel, GuiObject[], GuiObject[]] = []; //gui.Parent = p[uId].Parts[1] //gui.Adornee = p[uId].Parts[4] - BGui[1] = gui - BGui[2] = gui.Title - BGui[3] = gui.Extra - BGui[4] = {} //Parts of the gui to be recolored to the primary color - BGui[5] = {} //Parts of the gui to be recolored to the secondary color - for i, v in pairs(gui:GetDescendants()) do //Sort the rest of the GUI into these tables - local startLetter = sub(v.Name,1,1) - if startLetter == "p" then - insert(BGui[4],v) - elseif startLetter == "s" then - insert(BGui[5],v) - end - end + //gui; + let title = new inst("TextLabel");//gui.Title + let extra = new inst("TextLabel");//gui.Extra + let primaries: GuiObject[] = [] //Parts of the gui to be recolored to the primary color + let secondaries: GuiObject[] = [] //Parts of the gui to be recolored to the secondary color + for (let guiPiece of gui.GetDescendants()) { //Sort the rest of the GUI into these tables + if (guiPiece.IsA("GuiObject")) { + const startLetter = sub(guiPiece.Name,1,1) + if (startLetter == "p") { + primaries.push(guiPiece) + } else if (startLetter == "s") { + secondaries.push(guiPiece) + } + } + } + let bGui: [undefined, BillboardGui, TextLabel, TextLabel, GuiObject[], GuiObject[]] = [undefined, gui,title,extra,primaries,secondaries]; } -function setUp(Plr: Player) +function setUp(uId: number) { /* Chr = plr.Character repeat @@ -380,7 +382,7 @@ function setUp(Plr: Player) Hum = Chr.Humanoid Hum.MaxHealth = 200 Hum.Health = 200 - */ + if (Chr) { Plr = plrFromChr(plrs,Chr) } else { @@ -400,8 +402,14 @@ function setUp(Plr: Player) wait(1) StandardTransform(Plr,1,"QQ",nil,true) Output:FireClient(Plr,"SideColors",sideColorTable("Star",1)) + */ + let parts = getParts(uId); + assert(parts,"Server: Player by UserId of " + tS(uId) + " not found, giving up...")//if (!parts) { warn("Server: Player by UserId of " + tS(uId) + " not found, returning..."); return; } // One last chance to turn back + let wings = makeWings(parts); // From here, we are nihilists (if the thread errors, it errors) + makeDecor(wings, "SpectrumWing", "SpectrumCore") + return [undefined, parts, wings] as [undefined?, [undefined?, Model, Humanoid, Part, Part, Part, Part, Part, Part, Part], [undefined?, Folder, Part[][], Part]]; //waitForLeaveSpawn() -end +} //Mode switching functions //local TT = {}