Skip to content

Commit

Permalink
Added Destructable;
Browse files Browse the repository at this point in the history
Fixed PhysicsGun minor bugs;
Fixed Spawn rotation when reloading package;
  • Loading branch information
gtnardy committed Apr 29, 2022
1 parent 9630619 commit 32d8882
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 5 deletions.
13 changes: 12 additions & 1 deletion Client/DefaultAssets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ DEFAULT_ASSET_PACK = {
["SM_Cylinder"] = "basic",
["SM_Plane"] = "basic",
["SM_Sphere"] = "basic",
["SM_Pipe"] = "basic",
["SM_Capsule"] = "basic",
["SM_QuadPyramid"] = "basic",
["SM_Torus"] = "basic",
["SM_TriPyramid"] = "basic",
["SM_Tube"] = "basic",
["SM_Wedge_A"] = "basic",
["SM_Wedge_B"] = "basic",

["SM_Ball_VR"] = "basic",
["SM_Cube_VR_01"] = "basic",
Expand All @@ -15,6 +23,8 @@ DEFAULT_ASSET_PACK = {
["SM_Lamp"] = "furniture",
["SM_Flashlight"] = "funny",
["SM_Balloon"] = "funny",
["SM_Camera"] = "funny",
["SM_Error"] = "funny",

["SM_RockingChair"] = "furniture",
["SM_RoundStand"] = "furniture",
Expand Down Expand Up @@ -49,7 +59,8 @@ DEFAULT_ASSET_PACK = {
["SM_ASVal_Mag_Empty"] = "tools",
["SM_AK5C_Mag"] = "tools",
["SM_GE3_Mag_Empty"] = "tools",
["SM_1911_Mag"] = "tools",
["SM_M1911_Mag"] = "tools",
["SM_Makarov_Mag_Empty"] = "tools",
["SM_P90_Mag"] = "tools",
["SM_SA80_Mag_Empty"] = "tools",
["SM_UMP45_Mag_Empty"] = "tools",
Expand Down
7 changes: 7 additions & 0 deletions Client/SpawnMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ MainHUD:CallEvent("AddCategory", "weapons", "grenades", "Grenade", "images/categ
MainHUD:CallEvent("AddCategory", "weapons", "melee", "Melee", "images/categories/knife.png", "images/categories/knife-disabled.png")

MainHUD:CallEvent("AddCategory", "entities", "uncategorized", "Uncategorized", "images/categories/menu.png", "images/categories/menu-disabled.png")
MainHUD:CallEvent("AddCategory", "entities", "destructables", "Destructables", "images/categories/destructable.png", "images/categories/destructable-disabled.png")

-- Adds the default NanosWorld items
-- Default Weapons
Expand Down Expand Up @@ -402,6 +403,12 @@ AddSpawnMenuItem("nanos-world", "weapons", "Crowbar", "Crowbar", "assets///Nanos

AddSpawnMenuItem("nanos-world", "entities", "BouncyBall", "BouncyBall", "assets///NanosWorld/Thumbnails/SM_Sphere.jpg", "uncategorized")

AddSpawnMenuItem("nanos-world", "entities", "GC_Ball", "GC Ball", "assets///NanosWorld/Thumbnails/SM_Ball_VR.jpg", "destructables")
AddSpawnMenuItem("nanos-world", "entities", "GC_Cube_01", "GC Cube 01", "assets///NanosWorld/Thumbnails/SM_Cube_01.jpg", "destructables")
AddSpawnMenuItem("nanos-world", "entities", "GC_Cube_02", "GC Cube 02", "assets///NanosWorld/Thumbnails/SM_Cube_02.jpg", "destructables")
AddSpawnMenuItem("nanos-world", "entities", "GC_Cube_03", "GC Cube 03", "assets///NanosWorld/Thumbnails/SM_Cube_03.jpg", "destructables")
AddSpawnMenuItem("nanos-world", "entities", "GC_Pyramid", "GC Pyramid", "assets///NanosWorld/Thumbnails/SM_Pyramid.jpg", "destructables")

-- Defines some Spawn Menu Hints
AddNotification("SPAWN_MENU", "you can press Q to open the Spawn Menu", 10000, 30000)
AddNotification("SPAWN_MENU_DESTROY_ITEM", "you can press X to delete your last spawned item", 10000, 90000)
Expand Down
4 changes: 2 additions & 2 deletions Client/Tools/PhysicsGun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Client.Subscribe("KeyUp", function(key_name)
PhysicsGun.is_rotating_object = false

-- Updates rotation to match
if (PhysicsGun.is_snapping_to_grid) then
if (PhysicsGun.is_snapping_to_grid and PhysicsGun.picking_object) then
PhysicsGun.picking_object_initial_rotation = PhysicsGun.picking_object:GetRotation() - Client.GetLocalPlayer():GetControlledCharacter():GetRotation()
end

Expand All @@ -176,7 +176,7 @@ Client.Subscribe("KeyPress", function(key_name)

if (key_name == "E") then
PhysicsGun.is_rotating_object = true
return false
if (PhysicsGun.picking_object) then return false else return end
end

if (key_name == "LeftShift") then
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Client/UI/images/categories/destructable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Package.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# contributors
author = "nanos™"
# version
version = "2.10.4"
version = "2.11.0"
# image URL
image = "https://i.imgur.com/aoEa4N4.jpg"
# package type: 'script' (normal package), 'game-mode' (unique package - can only load one at a time) or 'loading-screen' (special package loaded in loading screen)
Expand Down
13 changes: 13 additions & 0 deletions Server/Entities/Destructable.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function SpawnDestructable(location, rotation, asset)
-- Spawns Destructable
local static_mesh = StaticMesh((location or Vector()) + Vector(0, 0, 70), (rotation or Rotator()) + Rotator(0, 90, 0), asset)
return static_mesh
end


-- Adds this to the Sandbox Spawn Menu
AddSpawnMenuItem("nanos-world", "entities", "GC_Ball", function(location, rotation) return SpawnDestructable(location, rotation, "NanosWorld/Props/VRShapes/GC_Ball") end)
AddSpawnMenuItem("nanos-world", "entities", "GC_Cube_01", function(location, rotation) return SpawnDestructable(location, rotation, "NanosWorld/Props/VRShapes/GC_Cube_01") end)
AddSpawnMenuItem("nanos-world", "entities", "GC_Cube_02", function(location, rotation) return SpawnDestructable(location, rotation, "NanosWorld/Props/VRShapes/GC_Cube_02") end)
AddSpawnMenuItem("nanos-world", "entities", "GC_Cube_03", function(location, rotation) return SpawnDestructable(location, rotation, "NanosWorld/Props/VRShapes/GC_Cube_03") end)
AddSpawnMenuItem("nanos-world", "entities", "GC_Pyramid", function(location, rotation) return SpawnDestructable(location, rotation, "NanosWorld/Props/VRShapes/GC_Pyramid") end)
2 changes: 1 addition & 1 deletion Server/Index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ Package.Subscribe("Unload", function()
for k, p in pairs(Player.GetAll()) do
local cha = p:GetControlledCharacter()
if (cha) then
table.insert(character_locations, { player = p, location = cha:GetLocation(), rotation = cha:GetRotation() })
table.insert(character_locations, { player = p, location = cha:GetLocation(), rotation = Rotator(0, cha:GetRotation().Yaw, 0) })
end
end

Expand Down
1 change: 1 addition & 0 deletions Server/SpawnMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,6 @@ Package.Require("Weapons/VeggieGun.lua")
Package.Require("Weapons/BouncyGun.lua")

Package.Require("Entities/CCTV.lua")
Package.Require("Entities/Destructable.lua")
Package.Require("Entities/Breakable.lua")
Package.Require("Entities/BouncyBall.lua")

0 comments on commit 32d8882

Please sign in to comment.