diff --git a/Data/Scripts/Loadouts_Server.lua b/Data/Scripts/Loadouts_Server.lua index 80ef5b0..08bcbc2 100644 --- a/Data/Scripts/Loadouts_Server.lua +++ b/Data/Scripts/Loadouts_Server.lua @@ -2,6 +2,7 @@ local ROOT = script:GetCustomProperty("Root"):WaitForObject() local LOADOUTS = require(ROOT:GetCustomProperty("Loadouts")) local SAVE_LOADOUT = ROOT:GetCustomProperty("SaveLoadout") +local FORCE_ON = ROOT:GetCustomProperty("ForceOn") local players = {} @@ -31,6 +32,10 @@ local function equip_item(player, item_index) }) players[player].active:Equip(player) + + if(FORCE_ON) then + players[player].active.visibility = Visibility.FORCE_ON + end end local function save_data(player) @@ -40,7 +45,7 @@ local function save_data(player) if(players[player] ~= nil and players[player].loadout_index ~= nil) then local data = {} - + pcall(function() data = Storage.GetPlayerData(player) end) @@ -77,7 +82,7 @@ end local function on_player_joined(player) local data = {} - + players[player] = {} if(SAVE_LOADOUT) then @@ -123,4 +128,4 @@ Events.ConnectForPlayer("Hotbar.Ready", ready) Events.ConnectForPlayer("Hotbar.Select", select_item) Game.playerJoinedEvent:Connect(on_player_joined) -Game.playerLeftEvent:Connect(on_player_left) \ No newline at end of file +Game.playerLeftEvent:Connect(on_player_left) diff --git a/Data/Templates/Loadouts.pbt b/Data/Templates/Loadouts.pbt index 066487d..d771688 100644 --- a/Data/Templates/Loadouts.pbt +++ b/Data/Templates/Loadouts.pbt @@ -56,6 +56,10 @@ Assets { Name: "cs:SaveLoadout" Bool: true } + Overrides { + Name: "cs:ForceOn" + Bool: true + } Overrides { Name: "cs:EnableHotbar" Bool: true @@ -171,6 +175,18 @@ Assets { Name: "cs:SlotNormalColor:tooltip" String: "The normal color of a slot in the hotbar." } + Overrides { + Name: "cs:ForceOn:tooltip" + String: "In some cases with other components such as costume equippers, the requipment will need to be forced on." + } + Overrides { + Name: "cs:ForceOn:category" + String: "Custom" + } + Overrides { + Name: "cs:ForceOn:subcategory" + String: "Loadout" + } } Collidable_v2 { Value: "mc:ecollisionsetting:inheritfromparent" diff --git a/Data/Templates/Loadouts_1.pbt b/Data/Templates/Loadouts_1.pbt new file mode 100644 index 0000000..402bba5 --- /dev/null +++ b/Data/Templates/Loadouts_1.pbt @@ -0,0 +1,43 @@ +Assets { + Id: 13121485076787381653 + Name: "Loadouts" + PlatformAssetType: 5 + TemplateAsset { + ObjectBlock { + RootId: 1650044587395406390 + Objects { + Id: 1650044587395406390 + Name: "TemplateBundleDummy" + Transform { + Location { + } + Rotation { + } + Scale { + X: 1 + Y: 1 + Z: 1 + } + } + Folder { + BundleDummy { + ReferencedAssets { + Id: 7967915417835585167 + } + } + } + } + } + PrimaryAssetId { + AssetType: "None" + AssetId: "None" + } + } + Marketplace { + Id: "387e57c444bd48d2969cc4cfb9bdd792" + OwnerAccountId: "bd602d5201b04b3fbf7be10f59c8f974" + OwnerName: "CoreAcademy" + Description: "This component is part of the Core Academy Essentials. A collection of useful components to help get started in Core.\r\n\r\nThe Loadouts component will give players the ability to switch their loadout in game. It comes with a simple loadout menu for players to select which loadout they want. It also contains a hotbar to allow for quick switching of their weapon/equipment.\r\n\r\nTo learn more on how to use this component, checkout the README included or the article linked below.\r\n\r\nhttps://learn.coregames.com/loadouts/\r\n\r\nFor any issues or bugs, please report them on GitHub.\r\n\r\nhttps://github.com/ManticoreGamesInc/CC-Loadouts/issues\r\n\r\nSee more Core Academy Essential components here.\r\n\r\nhttps://learn.coregames.com/core-academy-essentials\r\n" + } + SerializationVersion: 123 +}