diff --git a/client/init.server.lua b/client/init.server.lua index 719be83..0089642 100644 --- a/client/init.server.lua +++ b/client/init.server.lua @@ -438,8 +438,34 @@ local function setDebugStat(key: string, value: any) debugStats:SetAttribute(key, value) end + +--THIS IS WHERE THE SPAWNLOCATION IMPLEMENTATION IS +local function getTeamSpawnPosition(player) + local teamColor = player.TeamColor + local spawnLocations = game.Workspace:GetDescendants() + local teamSpawn = nil + + -- Find a spawn location with the same TeamColor as the player's team + for _, spawn in pairs(spawnLocations) do + if spawn.ClassName == "SpawnLocation" then + if spawn.TeamColor == teamColor then + teamSpawn = spawn + break + end + end + end + + if teamSpawn then + return teamSpawn.Position + else + warn("No spawn location found for team color: " .. tostring(teamColor)) + return game.workspace:FindFirstChild("SpawnLocation") --default + end +end + + local function onReset() - local roblox = Vector3.yAxis * 100 + local roblox = getTeamSpawnPosition(player) --THIS IS WHERE THE SPAWNLOCATION IMPLEMENTATION IS CALLED local sm64 = Util.ToSM64(roblox) local char = player.Character @@ -447,7 +473,6 @@ local function onReset() local reset = char:FindFirstChild("Reset") local cf = CFrame.new(roblox) - char:PivotTo(cf) goalCF = cf prevCF = cf diff --git a/server/StarterCharacter/Appearance/init.server.lua b/server/StarterCharacter/Appearance/init.server.lua index c271c01..0308150 100644 --- a/server/StarterCharacter/Appearance/init.server.lua +++ b/server/StarterCharacter/Appearance/init.server.lua @@ -80,13 +80,34 @@ character:SetAttribute("TimeScale", 1) character.DescendantAdded:Connect(onDescendantAdded) character.DescendantRemoving:Connect(onDescendantRemoving) +--THIS IS WHERE THE SPAWNLOCATION IMPLEMENTATION IS +local function getTeamSpawnPosition(player) + local teamColor = player.TeamColor + local spawnLocations = game.Workspace:GetDescendants() + local teamSpawn = nil + + -- Find a spawn location with the same TeamColor as the player's team + for _, spawn in pairs(spawnLocations) do + if spawn.ClassName == "SpawnLocation" then + if spawn.TeamColor == teamColor then + teamSpawn = spawn + break + end + end + end + + if teamSpawn then + return teamSpawn.Position + else + warn("No spawn location found for team color: " .. tostring(teamColor)) + return game.workspace:FindFirstChild("SpawnLocation") --default + end +end + + local function reload() character:ScaleTo(1) - task.spawn(function() - player:LoadCharacter() - end) - for retry = 1, 10 do local success, result = pcall(function() return Players:GetHumanoidDescriptionFromUserId(userId) @@ -144,4 +165,16 @@ reset.OnServerEvent:Connect(function(player) end end) +local RunService = game:GetService("RunService") + +function resetter() + if character.Humanoid.Health < 1 then + reload() + wait() + player:LoadCharacter() + end +end + task.spawn(reload) + +RunService.Heartbeat:Connect(resetter) \ No newline at end of file diff --git a/shared/Animations.model.json b/shared/Animations.model.json index 645b092..1251e13 100644 --- a/shared/Animations.model.json +++ b/shared/Animations.model.json @@ -2517,7 +2517,7 @@ "className": "Animation", "properties": { - "AnimationId": "rbxassetid://14101761759" + "AnimationId": "rbxassetid://913384386" }, "attributes": { @@ -2532,7 +2532,7 @@ "className": "Animation", "properties": { - "AnimationId": "rbxassetid://14101760003" + "AnimationId": "rbxassetid://913384386" }, "attributes": { diff --git a/shared/README.md b/shared/README.md index 5a585d8..4d045e0 100644 --- a/shared/README.md +++ b/shared/README.md @@ -1,3 +1,15 @@ -# Shared - Cloud Assets +# sm64-roblox-liberty-prime -This folder contains cloud asset mapping for custom Roblox assets that I use in funny 64-bit platformer. The content linked in here does not source from any assets or content from Nintendo. Voice acting was done by me, and animation work was done by Stalkalek. I also borrowed some stock sounds from Roblox. \ No newline at end of file +A fork of a port of Super Mario 64's movement code into Roblox Luau (in `--!strict` mode), hosted as a [rojo](https://rojo.space) project. Based on [the SM64 decompilation project](https://github.com/n64decomp/sm64) and [MaximumADHD's Port of movement code to ROBLOX](https://github.com/MaximumADHD/sm64-roblox). This is just a more "ready-to-use" version. + +Original game is hosted here:
+https://www.roblox.com/games/10238956318/funny-64-bit-platformer + +## Setting Up & Disclaimers +This project follows standard rojo conventions. You should install vscode and install the rojo extension, as well as the rojo plugin for Roblox Studio. + +Any bugs or behavioral quirks of the physics in this are intentional and will not be fixed. **No help will be provided for anything in here. It is NOT intended to be used as a foundation for new games and you're on your own if you choose to do so.** + +## Terms of Use + +You *may* use this in your game, **but you must provide credit** to this repository, MaximumADHD's repository, and the SM64 Decompilation Project. I would **NOT** advise using it as a foundation for a platformer since it's very rigidly tied to the 30hz physics simulation code of Super Mario 64. It's weirdly programmed and not very intuitive to build off of.