Projectile Replication is the system used and developed by Innovation Inc Thermal Power Plant on Roblox to manage disinfectors.
This project uses Rojo for the project structure. Four project files in included in the repository.
default.project.json- Structure for just the module within Wally projects.default-standalone.project.json- Structure for just the module to be published as a standalone module outside of Wally.demo.project.json- Full Roblox place that can be synced into Roblox studio and ran with demo models.demo-standalone.project.json- Full Roblox place that can be synced into Roblox studio and ran with demo models, but with the standalone module setup.
To set up the project dependencies with types:
wally install
rojo sourcemap demo.project.json --output sourcemap.json
wally-package-types --sourcemap sourcemap.json Packages/Compared to LocalAudio and LocalTween, this system is a lot more involved to set up.
Projectile sounds use LocalAudio for playing sounds. See the setup for LocalAudio for how to add sounds.
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 inLocalAudiowhen the projectile is fired from a source.string? DefaultReloadSound- Optional sound id to play inLocalAudiowhen 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, andParentwill be overwritten if set.
For an example, see the demo projectile.
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.
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.
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.
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.
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.
This project is available under the terms of the MIT License. See LICENSE for details.