Skip to content

Commit

Permalink
Removed and Updated SetNetworkAuthority;
Browse files Browse the repository at this point in the history
Added Emissive to CCTV;
Reduced delay when undoing;
  • Loading branch information
gtnardy committed Mar 11, 2022
1 parent ab21237 commit 36d2c4f
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 25 deletions.
1 change: 1 addition & 0 deletions Client/Entities/CCTV.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function SpawnAndSetCameraOnProp(prop, camera)
sc:AttachTo(camera, AttachmentRule.SnapToTarget, "", 0)

prop:SetMaterialFromSceneCapture(sc, 1)
prop:SetMaterialColorParameter("Emissive", Color(5, 5, 5))
end

Events.Subscribe("SpawnCCTV", SpawnAndSetCameraOnProp)
Expand Down
2 changes: 1 addition & 1 deletion Client/SpawnMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function UndoTick(delta_time)

if UndoDelay <= 0 then
DeleteItemFromHistory()
UndoDelay = 0.2
UndoDelay = 0.1
end
end

Expand Down
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.9.1"
version = "2.9.2"
# 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
3 changes: 0 additions & 3 deletions Server/Tools/Balloon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ Events.Subscribe("SpawnBalloon", function(player, spawn_location, rotation, forc
local color = Color.RandomPalette()
balloon:SetMaterialColorParameter("Tint", color)

-- Sets the player to be the network authority immediately of this Prop (so he can immediately start applying the force on it - on the client side)
balloon:SetNetworkAuthority(player)

-- Subscribes for popping when balloon takes damage
balloon:Subscribe("TakeDamage", function(self, damage, bone_name, damage_type, hit_from_direction, instigator, causer)
self:Destroy()
Expand Down
3 changes: 0 additions & 3 deletions Server/Tools/Lamp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Events.Subscribe("SpawnLamp", function(player, spawn_location, direction, entity
-- Spawns a Lamp Bulb prop
local prop_lamp = Prop(spawn_location, Rotator(), "nanos-world::SM_Flashlight", CollisionType.StaticOnly)

-- Sets the player to be the network authority immediately of this Prop
prop_lamp:SetNetworkAuthority(player)

-- Spawns a Point Light, with the color
local intensity = 75

Expand Down
3 changes: 0 additions & 3 deletions Server/Tools/Light.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ Events.Subscribe("SpawnLight", function(player, spawn_location, direction, entit
local prop_light = Prop(spawn_location, Rotator(), "nanos-world::SM_Lamp", CollisionType.Auto, true, false)
prop_light:SetCollision(CollisionType.StaticOnly)

-- Sets the player to be the network authority immediately of this Prop
prop_light:SetNetworkAuthority(player)

-- Sets the prop mesh emissive color to a random color
local color = Color.RandomPalette()
prop_light:SetMaterialColorParameter("Emissive", color * 50)
Expand Down
9 changes: 2 additions & 7 deletions Server/Tools/PhysicsGun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Events.Subscribe("PickUp", function(player, weapon, object, is_grabbing, picking
if (is_grabbing) then
-- Only updates the Network Authority if this entity is network distributed
if (object:IsNetworkDistributed()) then
object:SetNetworkAuthority(player, 3600000)
object:SetNetworkAuthority(player)
end

object:SetValue("IsBeingGrabbed", true, true)
Expand All @@ -22,11 +22,6 @@ Events.Subscribe("PickUp", function(player, weapon, object, is_grabbing, picking
Events.BroadcastRemote("SpawnSound", weapon:GetLocation(), "nanos-world::A_VR_Grab", false, 0.25, 0.9)
end
else
-- Resets the Network Authority, now anyone can authority this object
if (object:IsNetworkDistributed()) then
object:SetNetworkAuthority(player, 0)
end

object:SetValue("IsBeingGrabbed", false, true)

-- Resets TranslateTo and RotateTo movement
Expand Down Expand Up @@ -68,7 +63,7 @@ Events.Subscribe("UpdateObjectPosition", function(player, object, location, rota

-- Only updates the Network Authority if this entity is network distributed
if (object:IsNetworkDistributed()) then
object:SetNetworkAuthority(player, 3600000)
object:SetNetworkAuthority(player)
end
end)

Expand Down
3 changes: 0 additions & 3 deletions Server/Tools/Thruster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ Events.Subscribe("SpawnThruster", function(player, spawn_location, direction, en
-- Adds a constant force to the Thruster
thruster:SetForce(Vector(100000, 0, 0), true)

-- Sets the player to be the network authority immediately of this Prop (so he can immediately start applying the force on it - on the client side)
thruster:SetNetworkAuthority(player)

-- Gets the relative location rotated to attach to the exact point the player aimed
thruster:AttachTo(entity, AttachmentRule.KeepWorld, "", 1)

Expand Down
3 changes: 0 additions & 3 deletions Server/Tools/Trail.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ Events.Subscribe("SpawnTrail", function(player, spawn_location, direction, entit
particle:AttachTo(trail, AttachmentRule.SnapToTarget, "", 0)
particle:SetRelativeLocation(rotation:RotateVector(direction * 10))

-- Sets the player to be the network authority immediately of this Prop (so he can immediately start applying the force on it - on the client side)
trail:SetNetworkAuthority(player)

-- Gets the relative location rotated to attach to the exact point the player aimed
trail:AttachTo(entity, AttachmentRule.KeepWorld, "", 0)

Expand Down
1 change: 0 additions & 1 deletion Server/Weapons/HFG.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function SpawnHFG(location, rotation)

local grenade = Grenade(spawn_location, Rotator(), "nanos-world::SM_Grenade_G67", "nanos-world::P_Explosion_Dirt", "nanos-world::A_Explosion_Large")
grenade:SetScale(Vector(3, 3, 3))
grenade:SetNetworkAuthority(character:GetPlayer())

local trail_particle = Particle(spawn_location, Rotator(), "nanos-world::P_Ribbon", false, true)
trail_particle:SetParameterColor("Color", Color.RandomPalette())
Expand Down

0 comments on commit 36d2c4f

Please sign in to comment.