
Subplane
RUST PLUGIN
CA$12.00
Overview:
The "Subplane" plugin introduces a custom flying submarine vehicle in Rust, with advanced features such as weapon systems, turret variants, and player interaction commands. It is created by HUSTLER4LIFE420 and is version 1.6.2. The plugin allows players to spawn, control, recall, and delete a submarine, which can be equipped with weapons and turrets for combat.
Core Components:
1. Entity Prefabs and Data Structures:
Prefabs:
Submarine (
SubPrefab)Kayak wings (
KayakPrefab)Ammo crate (
SmallCratePrefab)Turret (
TurretPrefab)
Data Storage:
playerSubplanes: A dictionary mapping player IDs to their spawned submarine entities for easy management.
2. Commands:
subplane [delete]: Spawn or delete a player's submarine.tsubplane: Spawn a submarine with a turret.recall subplane: Recall the player's submarine to their vicinity.
Main Functions:
Spawning and Deleting:
CmdSpawn(): Handles the spawn command; deletes existing submarine if present, then spawns a new one in front of the player.CmdSpawnTurret(): Similar to spawn but also adds a turret.SpawnSubplane(): Creates the submarine entity at a position slightly ahead of the player, adjusts height to water level, adds components, and optionally adds a turret.DeleteSubplane(): Removes the player's current submarine entity.RecallSubplane(): Teleports the submarine to a position in front of the player, maintaining water height and resetting velocity.
Entity Lifecycle:
OnEntityKill(): Cleans up theplayerSubplanesdictionary when a submarine is destroyed.
Submarine Behavior & Controls (SubplaneComponent Class):
This class manages the submarine's physics, movement, weapons, and interactions.
Initialization (Init())
Sets up physics properties like mass, drag, and angular velocity.
Adds wings (kayaks) as visual components.
Spawns optional ammo crates and turrets.
Wings and Visuals:
Wings are added at specific local positions to give the submarine a more realistic appearance.
Physics & Movement (FixedUpdate())
The core loop runs every physics tick.
Checks for driver input and applies forces/torques for:
Thrust (forward movement)
Altitude control (lift and dive)
Rotation (pitch, yaw, roll)
Speed limiting based on underwater/air conditions
Surface buoyancy
Ceiling enforcement to prevent exceeding max altitude
Aerodynamic lift for realism
Weapon System:
Can switch between rocket mode and gun mode using the secondary fire button.
Fires rockets or bullets when the reload button is pressed, provided there's ammo in the storage crate.
Finds appropriate ammo or rockets in the connected storage.
Ammo & Rocket Handling:
FindAmmoStorage(): Locates the ammo crate within proximity or uses the stored reference.FindRocketInStorage(),Find556InStorage(): Checks for available rockets and bullets.Spawns projectiles/entities for rockets and bullets with velocities, simulating firing.
Additional Features:
Turret: An auto-turret can be spawned on the submarine, authorized for the owner.
Crate: An ammo crate is spawned as a storage container for ammunition.
Physics & Controls: Uses Rigidbody physics to simulate realistic submarine movement, including buoyancy, lift, dive, and rotation.
Summary:
Your plugin creates an immersive flying submarine experience with:
Easy spawn, recall, and delete commands.
Realistic physics-based movement controlled by player inputs.
Weapon systems with switching modes and ammo management.
Visual enhancements with wings.
Optional turret for additional firepower.
Safe handling of entity lifecycle events.