{"TotalCount":14,"Files":[{"Ident":"vgproductions.s_box_dev_helper","Path":".obj/__compiler_extra.cs","FileName":"__compiler_extra.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"global using static Sandbox.Internal.GlobalGameNamespace;\r\nglobal using Microsoft.AspNetCore.Components;\r\nglobal using Microsoft.AspNetCore.Components.Rendering;\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonTitle\u0022, \u0022S\u0026box Dev Helper\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonIdent\u0022, \u0022s_box_dev_helper\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022OrgIdent\u0022, \u0022vgproductions\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022Ident\u0022, \u0022vgproductions.s_box_dev_helper\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022EngineVersion\u0022, \u002229\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022EngineMinorVersion\u0022, \u00221\u0022 )]\r\n\r\n[assembly: System.Runtime.Versioning.TargetFramework( \u0022.NETCoreApp,Version=v9.0\u0022, FrameworkDisplayName = \u0022.NET 9.0\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022CompileTime\u0022, \u00222026-09-13T12:00:57.9527069Z\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyVersion(\u00220.0.132.0\u0022)]\r\n[assembly: global::System.Reflection.AssemblyFileVersion(\u00220.0.132.0\u0022)]"},{"Ident":"vgproductions.s_box_dev_helper","Path":"RaycastCar.cs","FileName":"RaycastCar.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using System;\r\nusing System.Reflection.Metadata.Ecma335;\r\nusing System.Xml.Xsl;\r\nusing Sandbox;\r\npublic sealed class RaycastCar : Component\r\n{\r\n\r\n\t// [WARNING] This is not currently finished. The breaks are currently not working and the collisions are a bit junky!\r\n\t// [NOTICE] This is still not a tutorial, i will add comments so you can understand the code at a later time! (Statement was written at 12th September 2026)\r\n\r\n\t//This is a simple raycast car that also works in multiplayer!\r\n\t//This particular raycast car is single ray only so it is not very acurrate on small bumps!\r\n\r\n\t//This code ofcourse goes together with the wheel component!\r\n\r\n\t[Property] [Category(\u0022Wheels\u0022)] List\u003CCarWheelComponent\u003E Wheels {get; set;}\r\n\r\n\t[Property] [Category(\u0022RigidBody\u0022)] Rigidbody RB {get; set;}\r\n\r\n\t[Property] [Category(\u0022Vehicle\u0022)] float Acceleration {get; set;} = 500000f;\r\n\t[Property] [Category(\u0022Vehicle\u0022)] Curve AccelerationCurve {get; set;}\r\n\t[Property] [Category(\u0022Vehicle\u0022)] float MaxSpeed {get; set;} = 20f;\r\n\t[Property] [Category(\u0022Vehicle\u0022)] float TireTurnSpeed {get; set;} = 100f;\r\n\t[Property] [Category(\u0022Vehicle\u0022)] int TireMaxTurnDegrees {get; set;} = 25;\r\n\t[Property] [Category(\u0022Vehicle\u0022)] GameObject DriverSeat {get; set;}\r\n\t[Property] [Category(\u0022Vehicle\u0022)] GameObject CarBody {get; set;}\r\n\r\n\t[Property] [Category(\u0022SteeringWheel\u0022)] GameObject SteeringWheel {get; set;}\r\n\t[Property] [Category(\u0022SteeringWheel\u0022)] GameObject SteeringWheelTurnedRight {get; set;}\r\n\t[Property] [Category(\u0022SteeringWheel\u0022)] GameObject SteeringWheelTurnedLeft {get; set;}\r\n\t[Property] [Category(\u0022SteeringWheel\u0022)] GameObject SteeringWheelTurnedMiddle {get; set;}\r\n\t[Property] [Category(\u0022SteeringWheel\u0022)] float SteeringWheelTurneSpeed {get; set;} = 5f;\r\n\r\n\t[Property] [Category(\u0022Sounds\u0022)] SoundPointComponent EngineSound {get; set;}\r\n\t[Property] [Category(\u0022Sounds\u0022)] float EngineSoundLenght {get; set;} = 37;\r\n\t[Property] [Category(\u0022Sounds\u0022)] SoundEvent SitSoundEvent {get; set;}\r\n\r\n\tprivate int motorInput = 0;\r\n\t[Sync] [Property] public float TurnInput {get; private set;} = 0;\r\n\tprivate bool HandBreak = false;\r\n\tprivate bool IsBraking = false;\r\n\tprivate float MultipliedTurnInput = 0;\r\n\tprivate bool DriverSeatOccupied = false;\r\n\tprivate List\u003CBaseChair\u003E CarChairs = new List\u003CBaseChair\u003E();\r\n\r\n\tprivate TimeUntil _EndEngineSound;\r\n\r\n\tprivate void SingleWheelSuspension(CarWheelComponent WheelComp)\r\n\t{\r\n\t\t//Fire a raycast\r\n\t\tvar endPosition = WheelComp.Wheel.WorldPosition \u002B (-WheelComp.Wheel.WorldTransform.Up * WheelComp.RaycastLenght);\r\n\t\tvar Raycast =  Scene.Trace.Ray(WheelComp.Wheel.WorldPosition, endPosition).WithCollisionRules(\u0022carraycast\u0022).Run();\r\n\t\tif (Raycast.Hit)\r\n\t\t{\r\n\t\t\t//We have hit something lets do this!\r\n\t\t\t//* Move Wheels Up-Down\r\n\r\n\t\t\t//Some normal variables to use later\r\n\t\t\tvar contact = Raycast.HitPosition;\r\n\t\t\tvar springUpDirection = WheelComp.Wheel.WorldTransform.Up;\r\n\t\t\tvar springLenght = Vector3.DistanceBetween(WheelComp.Wheel.WorldPosition, contact) - WheelComp.WheelRadius;\r\n\t\t\tvar offsetDistance = WheelComp.RestDistance - springLenght;\r\n\r\n\t\t\t//Positon Wheels\r\n\t\t\tWheelComp.WheelRenderer.LocalPosition = Vector3.Lerp(WheelComp.WheelRenderer.LocalPosition, new Vector3(WheelComp.WheelRenderer.LocalPosition.x, WheelComp.WheelRenderer.LocalPosition.y, -springLenght), WheelComp.TireLerpSpeed * Time.Delta, false);\r\n\r\n\t\t\t//Calculate spring force\r\n\t\t\tvar SpringForce = WheelComp.SpringStrenght * offsetDistance;\r\n\r\n\t\t\tvar WorldVelocity = RB.GetVelocityAtPoint(WheelComp.Wheel.WorldPosition);\r\n\t\t\tvar RelativeVelocity = springUpDirection.Dot(WorldVelocity);\r\n\t\t\tvar springDampingForce = WheelComp.SpringDamping * RelativeVelocity;\r\n\r\n\t\t\tvar ForceVector = (SpringForce - springDampingForce) * springUpDirection;\r\n\t\t\tvar VerticalForceVector = new Vector3(0,0, ForceVector.z);\r\n\r\n\t\t\tRB.ApplyForceAt(WheelComp.Wheel.WorldPosition, VerticalForceVector);\r\n\r\n\t\t\t//* Rotate the wheel model! And also calculate some stuff for accelerating the car!\r\n\t\t\tvar ForwardDirection = WheelComp.Wheel.WorldTransform.Rotation.Forward;\r\n\t\t\tvar CarVelocity = Vector3.Dot(RB.Velocity, WorldRotation.Forward);\r\n\r\n\t\t\tWheelComp.WheelRenderer.WorldRotation = WheelComp.WheelRenderer.WorldRotation.RotateAroundAxis(Vector3.Forward, (float)(CarVelocity * Time.Delta / WheelComp.WheelRadius * 180f / Math.PI));\r\n\r\n\t\t\t//* Accelerate the car forwards\r\n\t\t\t//Move car\r\n\t\t\tif (motorInput != 0 \u0026\u0026 WheelComp.isMotor == true)\r\n\t\t\t{\r\n\t\t\t\t//Calculate speed and acceleration ratio so we get realistic acceleration\r\n\t\t\t\tvar SpeedRatio = Math.Abs(CarVelocity / MaxSpeed);\r\n\t\t\t\tvar AccelerationFactor = AccelerationCurve.Evaluate(SpeedRatio);\r\n\r\n\t\t\t\tvar ForwardForceVector = ForwardDirection * Acceleration * motorInput * AccelerationFactor;\r\n\r\n\t\t\t\tRB.ApplyForceAt(WheelComp.Wheel.WorldPosition, ForwardForceVector);\r\n\t\t\t}\r\n\r\n\t\t\t//* Rotate Neccecary wheels\r\n\t\t\tvar SteerSideDirection = WheelComp.SteeringGameObject.WorldTransform.Forward;\r\n\t\t\tvar TireVelocity = WorldVelocity;\r\n\t\t\tvar SteeringXVelocity = SteerSideDirection.Dot(TireVelocity);\r\n\r\n\t\t\tvar GripFactor = Math.Abs(SteeringXVelocity/TireVelocity.Length);\r\n\t\t\tvar YTraction = WheelComp.GripCurve.Evaluate(GripFactor); //! in the tutorial it is xTraction and xForce, because in godot it is that direction, but here it is Y\r\n\r\n\t\t\tif (HandBreak == true) YTraction = 0.1f;\r\n\r\n\t\t\tvar Gravity = 9.8f;\r\n\t\t\tvar YForce = -SteerSideDirection * SteeringXVelocity * YTraction * ((RB.Mass * Gravity)/4f);\r\n\r\n\t\t\t//FORCE WTRACTION (TRIBH)\r\n\t\t\tvar forwardVelocity = CarVelocity;\r\n\t\t\tvar ChosenTraction = WheelComp.WheelTraction;\r\n\t\t\tif (IsBraking == true) ChosenTraction = WheelComp.BrakesBackwardsTraction;\r\n\t\t\tvar BackwardsForce = WheelComp.Wheel.WorldTransform.Backward * forwardVelocity * ChosenTraction * ((RB.Mass * Gravity)/4f);\r\n\r\n\t\t\t//Apply forces\r\n\t\t\tRB.ApplyForceAt(WheelComp.Wheel.WorldPosition, YForce);\r\n\t\t\tRB.ApplyForceAt(WheelComp.Wheel.WorldPosition, BackwardsForce);\r\n\t\t}\r\n\t}\r\n\r\n\tprotected override void OnFixedUpdate()\r\n\t{\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//Do the wheel stuff\r\n\t\tforeach (var Wheel in Wheels)\r\n\t\t{\r\n\t\t\tSingleWheelSuspension(Wheel);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate void TurnSteeringWheel()\r\n\t{\r\n\t\t//* Turn the steering wheel\r\n\t\tif (TurnInput == 0)\r\n\t\t{\r\n\t\t\tSteeringWheel.WorldRotation = Rotation.Slerp(SteeringWheel.WorldRotation, SteeringWheelTurnedMiddle.WorldRotation, Time.Delta * SteeringWheelTurneSpeed, true);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif (TurnInput == 1)\r\n\t\t\t{\r\n\t\t\t\tSteeringWheel.WorldRotation = Rotation.Slerp(SteeringWheel.WorldRotation, SteeringWheelTurnedLeft.WorldRotation, Time.Delta * SteeringWheelTurneSpeed, true);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSteeringWheel.WorldRotation = Rotation.Slerp(SteeringWheel.WorldRotation, SteeringWheelTurnedRight.WorldRotation, Time.Delta * SteeringWheelTurneSpeed, true);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprivate void TurnTheWheels()\r\n\t{\r\n\t\t//* Turn the car\r\n\t\tMultipliedTurnInput = TurnInput * TireTurnSpeed;\r\n\r\n\t\tforeach (var WheelComp in Wheels)\r\n\t\t{\r\n\t\t\tif (WheelComp.isFrontWheel == true)\r\n\t\t\t{\r\n\t\t\t\tif (MultipliedTurnInput != 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar newYaw = Math.Clamp(WheelComp.Wheel.LocalRotation.Angles().yaw \u002B MultipliedTurnInput * Time.Delta, - TireMaxTurnDegrees, TireMaxTurnDegrees);\r\n\r\n\t\t\t\t\tWheelComp.Wheel.LocalRotation = WheelComp.Wheel.LocalTransform.Rotation.Angles().WithYaw( newYaw).ToRotation();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar newYaw = MathX.Approach(WheelComp.Wheel.LocalTransform.Rotation.Angles().yaw, 0, TireTurnSpeed * Time.Delta);\r\n\t\t\t\t\tWheelComp.Wheel.LocalRotation = WheelComp.Wheel.LocalTransform.Rotation.Angles().WithYaw( newYaw).ToRotation();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\t_EndEngineSound = 1f;\r\n\t}\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\t//* Play Audio if someone sits on the chair\r\n\t\tvar CarBodyChildren = CarBody.Children;\r\n\t\tforeach (var ChairGameObject in CarBodyChildren)\r\n\t\t{\r\n\t\t\tvar Chair = ChairGameObject.GetComponent\u003CBaseChair\u003E();\r\n\t\t\tif (Chair == null) continue;\r\n\r\n\t\t\tif (Chair.IsOccupied == true \u0026\u0026 !CarChairs.Contains(Chair))\r\n\t\t\t{\r\n\t\t\t\tCarChairs.Add(Chair);\r\n\t\t\t\tSound.Play(SitSoundEvent, ChairGameObject.WorldPosition);\r\n\t\t\t}\r\n\t\t\telse if (Chair.IsOccupied == false \u0026\u0026 CarChairs.Contains(Chair))\r\n\t\t\t{\r\n\t\t\t\tSound.Play(SitSoundEvent, ChairGameObject.WorldPosition);\r\n\t\t\t\tCarChairs.Remove(Chair);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\r\n\t\t//These happen for the owner and the other clients\r\n\t\tDriverSeatOccupied = DriverSeat.GetComponent\u003CBaseChair\u003E().IsOccupied;\r\n\r\n\t\t//* Turn the steering wheel\r\n\t\tTurnSteeringWheel();\r\n\r\n\t\t//* Turn the car\r\n\t\tTurnTheWheels();\r\n\r\n\t\t//* Car Sounds\r\n\t\tif (DriverSeatOccupied == false)\r\n\t\t{\r\n\t\t\t//Stop engine sounds\r\n\t\t\tEngineSound.StopSound();\r\n\t\t\t_EndEngineSound = .1f;\r\n\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//Adjust the sound volume based on speed\r\n\t\t\tvar CarVelocity = Vector3.Dot(RB.Velocity, WorldRotation.Forward);\r\n\t\t\tvar SoundVolume = CarVelocity / 570 * 2.5f; //! Max Velocity\r\n\r\n\t\t\tEngineSound.Volume = SoundVolume;\r\n\r\n\t\t\t//See if we should play the sound or not\r\n\t\t\tif (_EndEngineSound)\r\n\t\t\t{\r\n\t\t\t\t_EndEngineSound = EngineSoundLenght;\r\n\t\t\t\tEngineSound.StopSound();\r\n\t\t\t\tEngineSound.StartSound();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//* Check if a player has sut on the driver seat\r\n\t\tvar CurrentSittingPlayer = DriverSeat.Components.GetInDescendants\u003CPlayerController\u003E();\r\n\t\tif (CurrentSittingPlayer != null \u0026\u0026 CurrentSittingPlayer.GameObject.IsProxy == true)\r\n\t\t{\r\n\t\t\t//We have found that a player who does not own the car has sut on the car, so we need to change the ownership!\r\n\t\t\tGameObject.Network.AssignOwnership(CurrentSittingPlayer.GameObject.Network.Owner);\r\n\t\t\tCarBody.Network.AssignOwnership(CurrentSittingPlayer.GameObject.Network.Owner);\r\n\t\t}\r\n\r\n\t\t//* See if someone has the seat occupied!\r\n\t\tif (DriverSeatOccupied == false )\r\n\t\t{\r\n\t\t\t//* All settings are default\r\n\t\t\tTurnInput = 0;\r\n\t\t\tHandBreak = false;\r\n\t\t\tIsBraking = false;\r\n\t\t\tmotorInput = 0;\r\n\t\t\tMultipliedTurnInput = 0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//* Forwards backwards\r\n\t\t\t//Accelerate\r\n\t\t\tif (Input.Pressed(\u0022CarAccelerate\u0022)) motorInput = 1;\r\n\t\t\tif (Input.Released(\u0022CarAccelerate\u0022)) motorInput = 0;\r\n\r\n\t\t\t//Descelerate\r\n\t\t\tif (Input.Pressed(\u0022CarDescelerate\u0022)) motorInput = -1;\r\n\t\t\tif (Input.Released(\u0022CarDescelerate\u0022)) motorInput = 0;\r\n\r\n\t\t\t//* Turning Right \u0026 Left\r\n\t\t\tTurnInput = 0;\r\n\r\n\t\t\tif (Input.Down(\u0022CarTurnLeft\u0022)) TurnInput \u002B= 1;\r\n\t\t\tif (Input.Down(\u0022CarTurnRight\u0022)) TurnInput -= 1;\r\n\r\n\t\t\t//* Handbreak\r\n\t\t\tif (Input.Down(\u0022CarHandBrake\u0022)) HandBreak = true; else HandBreak = false;\r\n\t\t\t//* Car brakes\r\n\t\t\tif (Input.Down(\u0022CarBrake\u0022)) IsBraking = true; else IsBraking = false;\r\n\r\n\t\t}\r\n\t}\r\n\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleObbySystem.cs","FileName":"SimpleObbySystem.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class SimpleObbySystem : Component\r\n{\r\n\t//To look for the other checkpoint code, go to the simple checkpoint system! (These 2 are connected)\r\n\r\n\t//This is going to be a simple obby system.\r\n\t//It will have checkpoints, and \u0022death\u0022 if the player falls too low in world height\r\n\r\n\t//Here we set up some initial properties\r\n\t[Property] [Sync] public int CurrentCheckpoint {get; set;}\r\n\t[Property] private int StartingCheckpoint {get; set;} = 1;\r\n\r\n\t[Property] private int DeathHeight = -400;\r\n\t[Property] public Vector3 RespawnPositon;\r\n\r\n\t//Quick note: you have to input the values in the editor\r\n\r\n\t//We will first make a simple death function wich is going to be public, so implementing kill bricks or other death related stuff will be easier\r\n\tpublic void Death()\r\n\t{\r\n\t\tif (IsProxy) return;\r\n\r\n\t\tGameObject.WorldPosition = RespawnPositon;\r\n\t}\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//Some Simple Setup\r\n\t\tCurrentCheckpoint = StartingCheckpoint;\r\n\t}\r\n\r\n\tprotected override void OnFixedUpdate()\r\n\t{\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//In here we will check player height, and if it falls below a spesific threshold, we move the player to the wanted checkpoint\r\n\r\n\t\tif( GameObject.WorldPosition.z \u003C= DeathHeight)\r\n\t\t{\r\n\t\t\t//I have this commented because i dont want the obby system to be active in the scene!\r\n\t\t\t//Death();\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleTrigger.cs","FileName":"SimpleTrigger.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class SimpleTrigger : Component, Component.ITriggerListener //You need this so it actually listens when a player enters the collider\r\n{\r\n\r\n\t//Requirments\r\n\t//1) For this to work you will need to have a collider of any kind and have Trigger Enabled\r\n\t//2) Have the gameobject an appropriate tag and make sure the tag can collide with the player tag (you can skip this part). To make it collidable with the player tag, go to the project settings --\u003E Physics and find your tag, if it does not exist just press the \u002B and add it in. After you have seen it, make sure you have the tags on triggers!\r\n\r\n\t//3) have this function. Other, is the gameobject that has collided\r\n\tpublic void OnTriggerEnter(Collider other)\r\n\t{\r\n\t\t//Check if what we have collided with is a player\r\n\t\tif (other.Tags.Has(\u0022player\u0022))\r\n\t\t{\r\n\t\t\t//Run whatever code you want in here\r\n\t\t\tLog.Info(\u0022Stepped Inside the trigger\u0022);\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"MultiplayerTips.cs","FileName":"MultiplayerTips.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class MultiplayerTips : Component\r\n{\r\n\t//With the following in mind, multiplayer compatability will be easy\r\n\r\n\t/* When creating multiplayer you need to have one thing in mind,\r\n\tthat every script in the scene that is shared among the players\r\n\tis run by all the players. Lets see an example */\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\t/*The code here will run on all the players, but we want only our own player to run \r\n\t\tthis code. In that case we can use:*/\r\n\t\t\r\n\t\tif (IsProxy)\r\n\t\t{\r\n\t\t\t//this code is run by the clients that dont own this gameobject\r\n\t\t\tLog.Info(\u0022Hello, other player here\u0022);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//this code is run by the client that owns the gameobject\r\n\t\t\tLog.Info(\u0022I am the proud owner of this player\u0022);\r\n\t\t}\r\n\t\t\r\n\t\t//As long as an object has an owner we can use IsProxy to see if our client is an owner of that object and determen what we want to do with that information\r\n\t}\r\n\r\n\t//Now to share information along the other clients we can use these variables\r\n\r\n\t[Property] [Sync] public bool isCrouching {get; set;} = false;\r\n\r\n\t//Every property that has [Sync] can be changed only by the owner of the object and the variable is networked across all the clients.\r\n\t//These are super usefull for transfering information to other players, like inventory and other stuff\r\n\r\n\t//Lets make a simple example of the player pressing a button\r\n\r\n\t[Property] [Sync] public bool PressingForwardKey {get; set;} = false;\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tif (!IsProxy)\r\n\t\t{\r\n\t\t\t//We dont want other players here\r\n\r\n\t\t\t//We can use Input.Down to see if a spesific action is actively being holded down. You can find default action names or create your own in the settings --\u003E input\r\n\t\t\tif (Input.Down(\u0022Forward\u0022)) PressingForwardKey = true; else PressingForwardKey = false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//This code is run by the other players\r\n\t\t\tif (PressingForwardKey == true) Log.Info(PressingForwardKey); //if the player owner is pressign the forward key, then we print true on the rest of the clients\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleAchievements.cs","FileName":"SimpleAchievements.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class SimpleAchievements : Component\r\n{\r\n\r\n\t//This is super easy, just giving achievements to player!\r\n\t//Put this script inside the player prefab\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\t//We dont want other players here, but it does not really matter in this example\r\n\t\tif(IsProxy) return;\r\n\r\n\t\t//Give the achievement, simple as that! (Create your achievements inside your game and make sure you put the correct name in there!)\r\n\t\tSandbox.Services.Achievements.Unlock(\u0022playedgame\u0022);\r\n\t}\r\n\r\n\t//Now lets make a more complext achievement\r\n\r\n\t[Property] public int ClickAmountForAchievement {get; set;} = 10;\r\n\tprivate int AmountOfTimesClicked = 0;\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//for more info on this look at SimpleFirstPersonFlashlight\r\n\t\tif (Input.Pressed(\u0022Attack1\u0022)) AmountOfTimesClicked \u002B= 1;\r\n\r\n\t\t//Now we need to check how many times we have pressed click and if we exceed the amount required give the achievement\r\n\t\tif (AmountOfTimesClicked \u003E= ClickAmountForAchievement) Sandbox.Services.Achievements.Unlock(\u0022clicker\u0022);\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleCheckpointSystem.cs","FileName":"SimpleCheckpointSystem.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class SimpleCheckpointSystem : Component, Component.ITriggerListener\r\n{\r\n\t//To look for the other checkpoint code, go to the simple obby system! (These 2 are connected)\r\n\r\n\t[Property] private int CheckpointNumber {get; set;}\r\n\r\n\t//This stuff is really primitive, but if you still dont know. Find the code called \u0022simple trigger\u0022 for more details\r\n\tpublic void OnTriggerEnter(Collider other)\r\n\t{\r\n\t\t//Check if what we have collided with is a player, and we own the player\r\n\t\tif (other.Tags.Has(\u0022player\u0022) \u0026\u0026 other.IsProxy == false)\r\n\t\t{\r\n\r\n\t\t\t//See if we can find the script\r\n\t\t\tvar SimpleObbySystem = other.GetComponentInParent\u003CSimpleObbySystem\u003E();\r\n\t\t\tif (SimpleObbySystem != null)\r\n\t\t\t{\r\n\t\t\t\t//If we have a lower checkpoint, then add this checkpoint as the current checkpoint\r\n\t\t\t\tif (SimpleObbySystem.CurrentCheckpoint \u003C CheckpointNumber)\r\n\t\t\t\t{\r\n\t\t\t\t\tSimpleObbySystem.CurrentCheckpoint = CheckpointNumber;\r\n\t\t\t\t\tSimpleObbySystem.RespawnPositon = GameObject.WorldPosition;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tLog.Error(\u0022Something went wrong!\u0022);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"Assembly.cs","FileName":"Assembly.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"global using Sandbox;\r\nglobal using System.Collections.Generic;\r\nglobal using System.Linq;\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleFirstPersonFlashlight.cs","FileName":"SimpleFirstPersonFlashlight.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox;\r\n\r\npublic sealed class SimpleFirstPersonFlashlight : Component\r\n{\r\n\t//In this example we will create a first person flashlight\r\n\t//Make sure this script in inside the player prefab, and there is a gameobject with a spot light component\r\n\r\n\t//Quick note: You can use the same stuff to make a first person viewmodel. Everything is the same, except for the light part...\r\n\r\n\t[Property] public SpotLight LightSource {get; set;}\r\n\t[Property] public float LerpSpeed {get; set;}\r\n\r\n\tprotected override void OnPreRender()\r\n\t{\r\n\t\t//Only the owner of this player object is allowed here!\r\n\t\tif (IsProxy) return;\r\n\t\t//We use this function so we dont have any visual errors when lerping our spotlight\r\n\r\n\t\t//Simple put the flashlight to the position of the camera\r\n\t\tLightSource.WorldPosition = new Vector3(Scene.Camera.WorldPosition);\r\n\r\n\t\t//And now lerp the rotation\r\n\t\t//We first input the start of the lerp, then the end, then the speed (We do Time.Delta so the lerp is consistent among all framerates)\r\n\t\t// and we put the last thing on true so it does not overshoot the target\r\n\t\tLightSource.WorldRotation = Rotation.Lerp(LightSource.WorldRotation, Scene.Camera.WorldRotation, LerpSpeed * Time.Delta, true);\r\n\t}\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tif (IsProxy)\r\n\t\t{\r\n\t\t\t//destroy the light for other players (this method of making the flashlight work would not work in multiplayer, as the other players dont know where each client\u0027s camera is)\r\n\t\t\t//Quick tip, you can make a [Sync] variables holding the positions and rotations and each client will update those and the other clients will read and do their thing\r\n\t\t\tLightSource.Destroy();\r\n\t\t}\r\n\t}\r\n\r\n\t//Now lets make it turn on and off\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//This is the default name for the left click in Settings --\u003E Input\r\n\t\tif (Input.Pressed(\u0022Attack1\u0022))\r\n\t\t{\r\n\t\t\t//What this does, is it just flips the Enabled the opposite way. Lets say it is Enabled = false, it would make it the oposite of Enabled = false, which is true\r\n\t\t\tLightSource.Enabled = !LightSource.Enabled;\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleNpc.cs","FileName":"SimpleNpc.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class SimpleNpc : Component\r\n{\r\n\t//In this simple Npc, we will make it so it just follows the closest player!\r\n\t//For more information on how this npc is setup, just download the files from my github! (link in my discord)\r\n\t//IMPORTANT! MAKE SURE THE NPC GAMEOBJECT IS SET TO NETWORKED GAMEOBJECT WITH AN OWNER!\r\n\r\n\t//Here we set up some variables\r\n\t[Property] public NavMeshAgent Agent {get; set;}\r\n\t[Property] public SkinnedModelRenderer Body {get; set;}\r\n\tprivate GameObject CurrentTarget;\r\n\r\n\t//We need to run this on this, so it does not lag a lot.\r\n\tprotected override void OnFixedUpdate()\r\n\t{\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//We only need this code to run on the owner (i would suggest you make the host the owner or do whatever, i dont care)\r\n\r\n\t\t//Here we just make a table of all the gameobjects with the player tag\r\n\t\tvar AllPlayers = Scene.FindAllWithTag(\u0022player\u0022);\r\n\r\n\t\t//Make sure closest distance is something big\r\n\t\tvar closestDistance = 99999999999999999999999f;\r\n\t\tvar CurrentPlayer = GameObject;\r\n\r\n\t\t//now we will loop through each one\r\n\t\t//and we will try to find the closest player\r\n\t\tforeach (var player in AllPlayers)\r\n\t\t{\r\n\t\t\t//We might have ragdolls with the player tag, this ensures that actuall players are calculated\r\n\t\t\tif (player.Components.Get\u003CPlayerController\u003E() == null) continue;\r\n\r\n\t\t\t//Simple code, just get the distance\r\n\t\t\tvar Distance = Vector3.DistanceBetween(player.WorldPosition, GameObject.WorldPosition);\r\n\r\n\t\t\t//If we are closer than the closest player we have found, update the variables to match the player\r\n\t\t\tif (Distance \u003C closestDistance)\r\n\t\t\t{\r\n\t\t\t\t//We update the new stuff\r\n\r\n\t\t\t\tCurrentPlayer = player;\r\n\t\t\t\tclosestDistance = Distance;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//This means we found no player. (This will normally not be needed, but it is good to be safe)\r\n\t\tif (CurrentPlayer != GameObject)\r\n\t\t{\r\n\t\t\t//Now we need to start following!\r\n\t\t\tCurrentTarget = CurrentPlayer;\r\n\t\t\tAgent.MoveTo(CurrentTarget.WorldPosition);\r\n\t\t}\r\n\t}\r\n\r\n\t//Now this is a bonus, if you have a animgraph set up inside the body of your npc\r\n\t//you can update some variables so animations can work\r\n\t//Here is something very simple\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\t//This happens regardless of owner or not, because we want all players to see the npc animations\r\n\t\tBody.Set(\u0022Velocity\u0022, Agent.Velocity.Length);\r\n\r\n\t\t//What we are doing here is simple, we are just passing the velocity of the Agent to the animgraph, and then it can \r\n\t\t//determen if Velocity \u003E 0 = play walking animation, if Velocity = 0 = play idle animation\r\n\r\n\t\tif (IsProxy) return;\r\n\r\n\t\t//This code will make the npc turn smoothly torwards the direction it is looking\r\n\t\tvar TargetRot = Rotation.LookAt(Agent.WishVelocity, Vector3.Up);\r\n\t\tWorldRotation = Rotation.Slerp(WorldRotation, TargetRot, Time.Delta * 8.0f);\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"CameraLerpExample.cs","FileName":"CameraLerpExample.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class CameraLerpExample : Component\r\n{\r\n\t//Here we will make a simple camera lerp example where the camera will smoothly follow the the target!\r\n\r\n\t//Set up some variables\r\n\t[Property] public GameObject CameraTarget {get; set;}\r\n\t[Property] public GameObject Camera {get; set;}\r\n\r\n\t//This determines how smoothly or choppy the camera will follow the target!\r\n\t[Property] public float CameraLerpSpeed {get; set;} = 5f;\r\n\t[Property] public float CameraRoationLerpSpeed {get; set;} = 5f;\r\n\r\n\tprotected override void OnPreRender()\r\n\t{\r\n\t\t//Here we will move the camera! (We are using prerender cause it will be coppy and laggy if we do it inside OnUpdate. (Quick note: I am not entirly sure about that though))\r\n\r\n\t\t//Here is where the magic happens (You can find everywhere what lerp actually does, i will not be explaining lerp itself here, just how you can use it!)\r\n\t\t// The first parameter is where we are, the second is where we want to go and the last you can imagine it like speed (not kinda but it works if you think it like that)\r\n\t\t// Time.Delta is like a balancing float so it keeps stuff the same on every frame rate (Because this function runs every frame, if you did not have Time.Delta then the camera would move faster on bigger FPS)\r\n\t\tCamera.WorldPosition = Vector3.Lerp(Camera.WorldPosition, CameraTarget.WorldPosition, Time.Delta * CameraLerpSpeed);\r\n\r\n\t\t//We now need to rotate the camera so it looks at the player\r\n\t\t//We first need to get the rotation the camera needs to be to be looking at the player so we can lerp it!\r\n\r\n\t\t//We first get the direction. Look position - Current Position\r\n\t\tvar direction = GameObject.WorldPosition - Camera.WorldPosition;\r\n\r\n\t\t//Now we get the rotation, and we make sure to add \u0022Vector3.Forward\u0022 so it looks at the forward direction\r\n\t\tvar LookRotation = Rotation.LookAt(direction, Vector3.Forward);\r\n\r\n\t\tAngles angles = LookRotation.Angles();\r\n\t\tangles.roll = 0;\r\n\r\n\t\t//Finally we need to lerp the rotation! (We use Slerp for rotation because its better :) )\r\n\t\tCamera.WorldRotation = Rotation.Slerp(Camera.WorldRotation, angles , Time.Delta * CameraRoationLerpSpeed);\r\n\t}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleNetworking.cs","FileName":"SimpleNetworking.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using System;\r\nusing System.Threading.Tasks;\r\nusing Sandbox.MovieMaker;\r\nusing Sandbox.Network;\r\n\r\nnamespace Sandbox;\r\n\r\npublic sealed class SimpleNetworking : Component, Component.INetworkListener\r\n{\r\n\t[Property] [Category(\u0022Multiplayer\u0022)] public GameObject PlayerPrefab { get; set; } // Here you will put the player prefab. If you dont have one, take the default player controller right click and turn it into a prefab\r\n\t[Property] [Category(\u0022Multiplayer\u0022)] public GameObject SpawnPoint { get; set; } //Here is the spawn position the player will spawn in\r\n\t[Property] [Category(\u0022Multiplayer\u0022)] public bool StartServer { get; set; } = true; // Just keep this true so it automatically creates a server when a player joins\r\n\r\n\tpublic void OnActive( Connection channel )\r\n\t{\t\r\n\t\t//This code runs when a new connection appears in the server and is only run on the host\r\n\t\tif ( !PlayerPrefab.IsValid() ) return;\r\n\r\n\t\t//Cloning the player prefab at the spawning position\r\n\t\tvar player = PlayerPrefab.Clone( SpawnPoint.WorldPosition );\r\n\r\n\t\t//Make the player gameobject a networked gameobject with the owner being the player. This makes it so the player is visible to the other players\r\n\t\tplayer.NetworkSpawn( channel );\r\n\t}\r\n\r\n\tprotected override async Task OnLoad()\r\n\t{\r\n\t\t//These come with the default network helper, just leave this here.\r\n\t\tif ( Scene.IsEditor )\r\n\t\t\treturn;\r\n\r\n\t\tif ( StartServer \u0026\u0026 !Networking.IsActive )\r\n\t\t{\r\n\t\t\tLoadingScreen.Title = \u0022Creating Lobby\u0022;\r\n\t\t\tawait Task.DelayRealtimeSeconds( 0.1f );\r\n\t\t\tNetworking.CreateLobby( new() );\r\n\t\t}\r\n\t}\r\n}"},{"Ident":"vgproductions.s_box_dev_helper","Path":"CarWheelComponent.cs","FileName":"CarWheelComponent.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class CarWheelComponent : Component\r\n{\r\n\t[Property] public float SpringStrenght {get; set;} = 10000f;\r\n\t[Property] public float SpringDamping {get; set;} = 400;\r\n\t[Property] public float RestDistance {get; set;} = 15f;\r\n\t[Property] public float RaycastLenght {get; set;} = 30f;\r\n\t[Property] public float WheelRadius {get; set;} = 15f;\r\n\t[Property] public bool isMotor {get; set;} = false;\r\n\t[Property] public bool isFrontWheel {get; set;} = false;\r\n\t[Property] public float WheelTraction {get; set;} = .05f;\r\n\t[Property] public Curve GripCurve {get; set;}\r\n\t[Property] public float TireLerpSpeed {get; set;} = 5f;\r\n\t[Property] public float BrakesBackwardsTraction {get; set;} = .25f;\r\n\r\n\t[Property] public GameObject WheelRenderer {get; set;}\r\n\t[Property] public GameObject SteeringGameObject {get; set;}\r\n\t[Property] public GameObject Wheel {get; set;}\r\n}\r\n"},{"Ident":"vgproductions.s_box_dev_helper","Path":"SimpleRaycast.cs","FileName":"SimpleRaycast.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":380424,"IsPrivate":false,"Code":"using Sandbox;\r\n\r\npublic sealed class SimpleRaycast : Component\r\n{\r\n\r\n\t//In this simple example you will learn how to use a raycast on for a first person game, to determent what items or objects are in front of the player\r\n\r\n\tprivate CameraComponent Camera;\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\t//Here we just get the scene camera, the one that the player has\r\n\t\tCamera = Scene.Camera;\r\n\t}\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\t\t//We want this code to run only on the client that owns the player\r\n\t\tif (IsProxy) return;\r\n\t\t//If the camera does not exist, then dont run anything\r\n\t\tif (Camera == null) return; \r\n\r\n\t\t//here is our raycast (Starting Position, EndPosition). We get the starting position by just getting the position of our camera.\r\n\t\t//Now the end position is a little tricky for a begginer, but it is simple. We first start from the camera position again, and \r\n\t\t//on the forward direction of the camera (where the camera is pointing), we go 100 units in that direction. And thats our end position\r\n\t\t//Now for the collisionRules you just need to create a tag with whatever name you want (here it is raycast), and inside settings --\u003E physics add \r\n\t\t//wich objects the ray will interact with. Just make sure to have player to not collide so it does not collide with your own player\r\n\t\tvar Raycast = Scene.Trace.Ray(Camera.WorldPosition, Camera.WorldPosition \u002B Camera.WorldRotation.Forward * 100).WithCollisionRules(\u0022raycast\u0022).Run();\r\n\t\r\n\t\t//There are a lot of other stuff you can get from the raycast but here are some of the basics\r\n\t\tif (Raycast.GameObject != null)\r\n\t\t{\r\n\t\t\t//Log.Info(Raycast.GameObject.Name);\r\n\t\t\t//Log.Info(Raycast.HitPosition);\r\n\t\t}\r\n\t}\r\n}\r\n"}]}