mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
26
gamemodes/ixhl2rp/plugins/bettergaslethal/meta/sh_player.lua
Normal file
26
gamemodes/ixhl2rp/plugins/bettergaslethal/meta/sh_player.lua
Normal file
@@ -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/
|
||||
--]]
|
||||
|
||||
local playerMeta = FindMetaTable("Player")
|
||||
|
||||
function playerMeta:HasPPE()
|
||||
local character = self:GetCharacter()
|
||||
if (!character) then return false end
|
||||
|
||||
local inventory = character:GetInventory()
|
||||
if (!inventory) then return false end
|
||||
|
||||
local clothingItems = inventory:GetItems(true)
|
||||
for _, v in pairs(clothingItems) do
|
||||
if (v.isPPE and v:GetData("equip")) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
14
gamemodes/ixhl2rp/plugins/bettergaslethal/sh_hooks.lua
Normal file
14
gamemodes/ixhl2rp/plugins/bettergaslethal/sh_hooks.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
function PLUGIN:SetupAreaProperties()
|
||||
ix.area.AddType("lethal gas")
|
||||
ix.area.AddProperty("Severity", ix.type.number, 1)
|
||||
end
|
||||
53
gamemodes/ixhl2rp/plugins/bettergaslethal/sh_plugin.lua
Normal file
53
gamemodes/ixhl2rp/plugins/bettergaslethal/sh_plugin.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
--[[
|
||||
| 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 PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Better Lethal Gas"
|
||||
PLUGIN.author = "Asimo but mainly Gr4ss"
|
||||
PLUGIN.description = "Essentially a broken down copy of the Better Gas plugin. Major thanks to Gr4ss for essentially coming up with 90% of this."
|
||||
|
||||
ix.util.Include("meta/sh_player.lua")
|
||||
ix.util.Include("sh_hooks.lua")
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
|
||||
if (SERVER) then
|
||||
PLUGIN.timerLethalGasChangeCallback = function(_, newVal)
|
||||
for k, v in ipairs(player.GetAll()) do
|
||||
local uniqueID = "ixLethalGas"..v:SteamID64()
|
||||
if (timer.Exists(uniqueID)) then
|
||||
timer.Adjust(uniqueID, newVal)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ix.config.Add("LethalGasDamageTimer", 5, "How often, in seconds, the damage timer for being in lethal gas should run.", PLUGIN.timerLethalGasChangeCallback, {
|
||||
data = {min = 1, max = 10, decimals = 0},
|
||||
category = "LethalGas"
|
||||
})
|
||||
ix.config.Add("LethalGasDamage", 5, "How much should the default damage of gas be?", nil, {
|
||||
data = {min = 1, max = 100, decimals = 1},
|
||||
category = "LethalGas"
|
||||
})
|
||||
ix.config.Add("GasVorts", true, "Should lethal gas damage those factions that are immune to gas?", nil, {
|
||||
category = "LethalGas"
|
||||
})
|
||||
ix.config.Add("GasBleedout", true, "Should lethal gas damage players in bleedout?", nil, {
|
||||
category = "LethalGas"
|
||||
})
|
||||
|
||||
ix.lang.AddTable("english", {
|
||||
lethalGasEntered = "Coś w powietrzu obciąża twoje ciało. Czujesz, że nie powinieneś tu przebywać bez odpowiedniej ochrony."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("polish", {
|
||||
lethalGasEntered = "Coś w powietrzu obciąża twoje ciało. Czujesz, że nie powinieneś tu przebywać bez odpowiedniej ochrony."
|
||||
})
|
||||
47
gamemodes/ixhl2rp/plugins/bettergaslethal/sv_hooks.lua
Normal file
47
gamemodes/ixhl2rp/plugins/bettergaslethal/sv_hooks.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
--[[
|
||||
| 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 IsValid = IsValid
|
||||
local ix = ix
|
||||
|
||||
function PLUGIN:PlayerLoadedCharacter(client, character)
|
||||
local uniqueID = "ixLethalGas" .. client:SteamID64()
|
||||
timer.Create(uniqueID, ix.config.Get("LethalGasDamageTimer"), 0, function()
|
||||
if (IsValid(client)) then
|
||||
if (!client.ixInArea) then return end
|
||||
|
||||
if (client:GetMoveType() == MOVETYPE_NOCLIP and !client:InVehicle()) then return end
|
||||
|
||||
if (!ix.config.Get("GasVorts")) then
|
||||
if (ix.faction.Get(client:Team()).noGas) then return end
|
||||
end
|
||||
|
||||
if (!ix.config.Get("GasBleedout")) then
|
||||
if (character:GetBleedout() > 0) then return end
|
||||
end
|
||||
|
||||
if (client.ixArea and ix.area.stored[client.ixArea] and ix.area.stored[client.ixArea].type == "lethal gas" and !client:HasPPE()) then
|
||||
client:TakeDamage(ix.area.stored[client.ixArea].properties.Severity * ix.config.Get("LethalGasDamage"), null, null)
|
||||
end
|
||||
else
|
||||
timer.Remove(uniqueID)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function PLUGIN:OnPlayerAreaChanged(client, oldID, newID)
|
||||
if (ix.area.stored[newID].type == "lethal gas") then
|
||||
if (client:GetMoveType() == MOVETYPE_NOCLIP and !client:InVehicle()) then return end
|
||||
|
||||
if (oldID and ix.area.stored[oldID] and ix.area.stored[oldID].type != "lethal gas" and ix.option.Get(client, "gasNotificationWarnings")) then
|
||||
client:ChatNotifyLocalized("lethalGasEntered")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user