mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
@@ -0,0 +1,212 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local surface = surface
|
||||
local derma = derma
|
||||
local string = string
|
||||
local hook = hook
|
||||
local math = math
|
||||
local table = table
|
||||
local ipairs = ipairs
|
||||
local IsValid = IsValid
|
||||
local ix = ix
|
||||
local CAMI = CAMI
|
||||
local Derma_StringRequest = Derma_StringRequest
|
||||
local net = net
|
||||
|
||||
|
||||
ITEM.base = "base_outfit"
|
||||
ITEM.name = "Conscript Suit Base"
|
||||
ITEM.description = "A base for Combine Suit functionality"
|
||||
ITEM.category = "Combine"
|
||||
|
||||
ITEM.maxArmor = 50
|
||||
ITEM.repairItem = "tool_repair"
|
||||
|
||||
ITEM.isRadio = true
|
||||
|
||||
if (CLIENT) then
|
||||
function ITEM:PaintOver(item, w, h)
|
||||
if (item:GetData("equip")) then
|
||||
surface.SetDrawColor(110, 255, 110, 100)
|
||||
surface.DrawOutlinedRect(1, 1, w - 2, h - 2)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ITEM:PopulateTooltip(tooltip)
|
||||
local panel = tooltip:AddRowAfter("name", "armor")
|
||||
panel:SetBackgroundColor(derma.GetColor("Warning", tooltip))
|
||||
panel:SetText("Armor: " .. (self:GetData("equip") and LocalPlayer():Armor() or self:GetData("armor", self.maxArmor)))
|
||||
panel:SizeToContents()
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:GetChannels(bForce)
|
||||
if ((bForce != false) and self.channels) then
|
||||
return self.channels
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:CanEquipOutfit(client)
|
||||
return true
|
||||
end
|
||||
|
||||
function ITEM:OnGetReplacement(client)
|
||||
local player = self.player or client
|
||||
if (self.replacement) then
|
||||
return self.replacement
|
||||
elseif (self.replacementString) then
|
||||
local model = "models/"..self.replacementString..string.match(player:GetModel(), "/%a+_?%d%d%.mdl$")
|
||||
if (string.find(model, "/male%d%d")) then
|
||||
model = string.gsub(model, "/male[01]", {["/male0"] = "/male_0", ["/male_1"] = "/male_1"}, 1)
|
||||
end
|
||||
return model
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnEquipped(client)
|
||||
local character = client:GetCharacter()
|
||||
client:SetArmor(self:GetData("armor", self.maxArmor))
|
||||
|
||||
local hairBGIndex = client:FindBodygroupByName("hair")
|
||||
local hairData = character:GetHair()
|
||||
if hairBGIndex != -1 then
|
||||
local groups = character:GetData("groups", {})
|
||||
groups[hairBGIndex] = hairData.hair or 0
|
||||
character:SetData("groups", groups)
|
||||
|
||||
client:SetBodygroup(hairBGIndex, hairData.hair or 0)
|
||||
end
|
||||
|
||||
if client and IsValid(client) then
|
||||
local replacements = self:OnGetReplacement(client) or self.replacement or client:GetModel()
|
||||
local skin = self.newSkin or client:GetSkin()
|
||||
local bodygroups = client:GetBodyGroups()
|
||||
|
||||
net.Start("ixRefreshBodygroupsInventoryModel")
|
||||
net.WriteString(replacements)
|
||||
net.WriteUInt(skin, 5)
|
||||
net.WriteTable(bodygroups)
|
||||
net.Send(client)
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnUnequipped(client)
|
||||
self:SetData("armor", math.Clamp(client:Armor(), 0, self.maxArmor))
|
||||
client:SetArmor(0)
|
||||
|
||||
if client and IsValid(client) then
|
||||
local replacements = client:GetModel()
|
||||
local skin = client:GetSkin()
|
||||
local bodygroups = client:GetBodyGroups()
|
||||
|
||||
net.Start("ixRefreshBodygroupsInventoryModel")
|
||||
net.WriteString(replacements)
|
||||
net.WriteUInt(skin, 5)
|
||||
net.WriteTable(bodygroups)
|
||||
net.Send(client)
|
||||
|
||||
local hairBGIndex = client:FindBodygroupByName("hair")
|
||||
local character = client:GetCharacter()
|
||||
local hairData = character:GetHair()
|
||||
if hairBGIndex != -1 then
|
||||
local groups = character:GetData("groups", {})
|
||||
groups[hairBGIndex] = hairData.hair or 0
|
||||
character:SetData("groups", groups)
|
||||
|
||||
client:SetBodygroup(hairBGIndex, hairData.hair or 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnDoDeathDrop(client)
|
||||
end
|
||||
|
||||
function ITEM:OnInstanced()
|
||||
self:SetData("armor", self.maxArmor)
|
||||
end
|
||||
|
||||
function ITEM:OnLoadout()
|
||||
if (!self:CanEquipOutfit()) then
|
||||
self:SetData("equip", false)
|
||||
elseif (self:GetData("equip")) then
|
||||
self.player:SetArmor(self:GetData("armor", self.maxArmor))
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnSave()
|
||||
if (self:GetData("equip") and self.maxArmor) then
|
||||
local armor = math.Clamp(self.player:Armor(), 0, self.maxArmor)
|
||||
self:SetData("armor", armor)
|
||||
if (armor != self.player:Armor()) then
|
||||
self.player:SetArmor(armor)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnRemoved()
|
||||
|
||||
local owner = self:GetOwner()
|
||||
if (owner) then
|
||||
for _, v in ipairs(self:GetChannels(true)) do
|
||||
ix.radio:RemoveListenerFromChannel(owner, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:Repair(client, amount)
|
||||
amount = amount or self.maxArmor
|
||||
local repairItem = client:GetCharacter():GetInventory():HasItem(self.repairItem)
|
||||
|
||||
if (repairItem) then
|
||||
if (repairItem.isTool) then
|
||||
repairItem:DamageDurability(1)
|
||||
else
|
||||
repairItem:Remove()
|
||||
end
|
||||
self:SetData("armor", math.Clamp(self:GetData("armor") + amount, 0, self.maxArmor))
|
||||
end
|
||||
end
|
||||
|
||||
ITEM.functions.Repair = {
|
||||
name = "Repair",
|
||||
tip = "repairTip",
|
||||
icon = "icon16/wrench.png",
|
||||
OnRun = function(item)
|
||||
local item = item
|
||||
local player = item.player
|
||||
|
||||
player:Freeze(true)
|
||||
player:SetAction("Repairing Armor...", 5, function()
|
||||
if !IsValid(player) then return end
|
||||
player:Freeze(false)
|
||||
item:Repair(player)
|
||||
end)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
if (IsValid(item.entity) or !IsValid(item.player)) then return false end
|
||||
if (item:GetData("equip") == true) then return false end
|
||||
if (item.repairItem == nil) then return false end
|
||||
if (item:GetData("armor") == item.maxArmor) then return false end
|
||||
|
||||
if timer.Exists("combattimer" .. item.player:SteamID64()) then
|
||||
item.player:Notify("You cannot use this item while in combat.")
|
||||
return false
|
||||
end
|
||||
|
||||
return item.player:GetCharacter():GetInventory():HasItem(item.repairItem)
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "CCR Combat Fatigues"
|
||||
ITEM.description = "Combat fatigues, fitted for a CCR Conscript."
|
||||
ITEM.category = "Clothing - Conscripts"
|
||||
ITEM.replacementString = "thomask_110"
|
||||
ITEM.model = Model("models/props_c17/BriefCase001a.mdl")
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.isCP = false
|
||||
@@ -0,0 +1,23 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Rebel CP Uniform"
|
||||
ITEM.description = "A CP Uniform that's been graffiti'd and given markings relevant to the global resistance cause for easier identification."
|
||||
ITEM.category = "Clothing - Resistance"
|
||||
ITEM.replacementString = "wn7new/metropolice_rebel"
|
||||
ITEM.model = Model("models/wn7new/metropolice/cpuniform.mdl")
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.isCP = false
|
||||
|
||||
ITEM.maxArmor = 50
|
||||
|
||||
ITEM.energyConsumptionRate = 0.002 -- fatigue_system
|
||||
@@ -0,0 +1,26 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Rebel Riot CP Uniform"
|
||||
ITEM.description = "A CP Uniform that's been graffiti'd and given markings relevant to the global resistance cause for easier identification."
|
||||
ITEM.category = "Clothing - Resistance"
|
||||
ITEM.replacementString = "wn7new/metropolice_rebel"
|
||||
ITEM.model = Model("models/wn7new/metropolice/cpuniform.mdl")
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.isCP = false
|
||||
ITEM.bodyGroups = {
|
||||
["cp_Armor"] = 2 -- The actual name of the bodypart, then number in that bodypart (model-wise)
|
||||
}
|
||||
|
||||
ITEM.maxArmor = 75
|
||||
|
||||
ITEM.energyConsumptionRate = 0.002 -- fatigue_system
|
||||
97
gamemodes/darkrp/plugins/rebelsuits/sh_hooks.lua
Normal file
97
gamemodes/darkrp/plugins/rebelsuits/sh_hooks.lua
Normal file
@@ -0,0 +1,97 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
local ix = ix
|
||||
|
||||
|
||||
function PLUGIN:CanPlayerEquipItem(client, item)
|
||||
if (item.isCombineMask) then
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return false end
|
||||
|
||||
local suit = ix.item.instances[character:GetCombineSuit()]
|
||||
if (!suit) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerUnequipItem(client, item)
|
||||
if (item == client:GetActiveCombineSuit() and client:HasActiveCombineMask()) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerDropItem(client, item)
|
||||
if (item == client:GetActiveCombineSuit() and client:HasActiveCombineMask()) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:SetupAreaProperties()
|
||||
ix.area.AddProperty("nexus", ix.type.bool, false)
|
||||
end
|
||||
|
||||
-- A function to get whether a player has a flashlight.
|
||||
function PLUGIN:PlayerSwitchFlashlight(client, enabled)
|
||||
local character = client:GetCharacter()
|
||||
if (!character) then return false end
|
||||
|
||||
local item = ix.item.instances[character:GetCombineSuit()]
|
||||
if (item) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerAddWaypoint(client)
|
||||
if (client:HasActiveCombineMask() or client:IsDispatch()) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerUpdateWaypoints(client)
|
||||
if (client:IsDispatch()) then
|
||||
return true
|
||||
elseif (client:HasActiveCombineMask() and client:IsCombineRankAbove("RL")) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerRemoveWaypoints(client)
|
||||
if (client:IsDispatch()) then
|
||||
return true
|
||||
elseif (client:HasActiveCombineMask() and client:IsCombineRankAbove("RL")) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerSeeWaypoints(client)
|
||||
if (client:HasActiveCombineMask() or client:IsDispatch()) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CheckCanTransferToEquipSlots(itemTable, oldInv, inventory)
|
||||
local client = itemTable.player or (oldInv and oldInv.GetOwner and oldInv:GetOwner()) or itemTable.GetOwner and itemTable:GetOwner()
|
||||
if client and IsValid(client) then
|
||||
if client:HasActiveCombineMask() and itemTable:GetData("suitActive") then
|
||||
return false, "You need to remove your mask first!"
|
||||
end
|
||||
|
||||
if oldInv and oldInv.vars and oldInv.vars.equipSlots then
|
||||
local headApparel = oldInv:GetItemAt(1, 1)
|
||||
if headApparel and headApparel.base and headApparel.base == "base_maskcp" then
|
||||
if itemTable.base == "base_combinesuit" then
|
||||
return false, "You need to remove your mask first!"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
55
gamemodes/darkrp/plugins/rebelsuits/sh_plugin.lua
Normal file
55
gamemodes/darkrp/plugins/rebelsuits/sh_plugin.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local ix = ix
|
||||
local CAMI = CAMI
|
||||
local player_manager = player_manager
|
||||
local LocalPlayer = LocalPlayer
|
||||
local bit = bit
|
||||
local string = string
|
||||
local SetNetVar = SetNetVar
|
||||
local net = net
|
||||
local pairs = pairs
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Rebel Suits"
|
||||
PLUGIN.author = "Gr4Ss -- Modified by Hayden"
|
||||
PLUGIN.description = "Adds rebel suits and stuff."
|
||||
|
||||
-- Hand fixes by M!NT
|
||||
for i = 1, 9 do
|
||||
player_manager.AddValidModel("CPModel", "models/wn7new/metropolice/male_0"..i..".mdl")
|
||||
end
|
||||
for i = 1, 7 do
|
||||
player_manager.AddValidModel("CPModel", "models/wn7new/metropolice/female_0"..i..".mdl")
|
||||
end
|
||||
for i = 1, 9 do
|
||||
player_manager.AddValidModel("CPModel", "models/wn7new/metropolice_c8/male_0"..i..".mdl")
|
||||
end
|
||||
for i = 1, 7 do
|
||||
player_manager.AddValidModel("CPModel", "models/wn7new/metropolice_c8/female_0"..i..".mdl")
|
||||
end
|
||||
player_manager.AddValidModel("CPModel", "models/willardnetworks/combine/ordinal.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/willardnetworks/combine/soldier.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/willardnetworks/combine/suppressor.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/willardnetworks/combine/charger.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/wn/ota_commander.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/wn/ota_elite.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/wn/ota_elite_summit.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/wn/ota_shotgunner.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/wn/ota_soldier.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/combine_super_soldier.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/wn/ota_skylegion.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/wn/ordinal.mdl")
|
||||
player_manager.AddValidModel("CPModel", "models/willardnetworks/combine/antibody.mdl")
|
||||
|
||||
player_manager.AddValidHands("CPModel", "models/weapons/c_arms_combine.mdl", 0, "00000000")
|
||||
Reference in New Issue
Block a user