Skip to content

IITPP-Roblox/Projectile-Replication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Projectile-Replication

Projectile Replication is the system used and developed by Innovation Inc Thermal Power Plant on Roblox to manage disinfectors.

Setup

Project

This project uses Rojo for the project structure. Two project files in included in the repository.

  • default.project.json - Structure for just the module. Intended for use with rojo build and to be included in Rojo project structures as a dependency.
  • demo.project.json - Full Roblox place that can be synced into Roblox studio and ran with demo models.

Game

Compared to LocalAudio and LocalTween, this system is a lot more involved to set up.

Audio (Optional)

Projectile sounds use LocalAudio for playing sounds. See the setup for LocalAudio for how to add sounds.

Projectile Presets

The projectiles in the game are stored as data that define the properties and behavior of the projectiles. At the moment, they are hard-coded to be MdouleScripts under ReplicatedStorage.Data.ProjectilePresets. The schema of the data for each preset is the following:

  • number Speed - Speed that the projectile moves at.
  • number LifetimeSeconds - The maximum lifetime of the projectile in seconds.
  • string? DefaultFireSound - Optional sound id to play in LocalAudio when the projectile is fired from a source.
  • string? DefaultReloadSound - Optional sound id to play in LocalAudio when a weapon is reloaded.
  • ProjectileAppearance Appearance - Appearance of the projectile, which is a table containing the following data:
    • number? LengthStuds - The length of the projectile in studs.
    • number? Diameter - Diameter of the projectile.
    • {[string]: any}? Properties - Additional properties to set. Size, CFrame, and Parent will be overwritten if set.

For an example, see the demo projectile.

Server / Client Setup

In order to set up the replication on both the client and server, ProjectileReplication:SetUp() needs to be invoked on both the client and server.

Standard Weapons (Optional)

For the Thermal Power Plant, a standard set of scripts are used for all disinfectors. They are loaded using the helper Standard module's CreateStandardWeapon method. In order to use it, the Tool must have a Handle. The Handle must have an Attachment named "StartAttachment" and optional Attachment for the left arm named "LeftHandHold". There also must be a Configuration like the demo configuration.

Nexus VR Character Model (Optional)

The standard weapons support Nexus VR Character Model. Adding the loader to the game will make Nexus VR Character Model load when the game starts.

Firing Projectiles Directly

In the case a projectile needs to be fired without using a standard weapon, such as the turrets in the Innovation Inc Thermal Power Plant, use ProjectileReplication:Fire(StartCFrame: CFrame, FirePart: BasePart, PresetName: string): (). The StartCFrame is the starting CFrame of the projectile with FirePart being the source part. If FirePart has an Attachment named StartAttachment, the attachment will be used for playing sounds. PresetName is the name of the module storing the projectile data to use.

Future Enhancements

Pull requests are open for future enhancements that could be made to the system. They have been requested either internally or by members of the Innovation Inc Thermal Plant Discord server.

  • Generalized Animations - Animations are currently limited to the hold animation. Reload animations, aiming down scopes, and holding the weapon down for posing are not supported.
  • Acceleration - Projectiles follow a straight path instead of accelerating due to gravity or other forces.
  • Touchscreen Support - Standard weapons do not support touchscreens. This makes them not work optimally on mobile platforms.
  • Fix Multi-Projectile Exploit - There is an active exploit for standard weapons where the reload delay is ignored as a security check if ProjectilePerRound is more than 1.
  • Fix Arms Bending Unnaturally - See the GitHub issue in Nexus VR Character Model.

License

This project is available under the terms of the MIT License. See LICENSE for details.

About

Manages projectiles on the client and server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages