mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
22
gamemodes/ixhl2rp/plugins/wncremator/cl_hooks.lua
Normal file
22
gamemodes/ixhl2rp/plugins/wncremator/cl_hooks.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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:InitPostEntity()
|
||||
timer.Create("crematorAmbience", 4.4133334159851, 0, function()
|
||||
for _, player in ipairs(player.GetAll()) do
|
||||
player:StopSound("npc/cremator/cremator_breath_new_loop.wav")
|
||||
|
||||
if (player:Team() == FACTION_CREMATOR and player:GetCharacter() and player:Alive()) then
|
||||
player:EmitSound("npc/cremator/cremator_breath_new_loop.wav", 70, 100, 0.6, CHAN_AUTO)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
--Main function
|
||||
function EFFECT:Init(data)
|
||||
--Muzzle and desired position vectors
|
||||
local StartPos = self:GetTracerShootPos(self.Position, data:GetEntity(), data:GetAttachment())
|
||||
local HitPos = data:GetOrigin()
|
||||
|
||||
if (data:GetEntity():IsValid() and StartPos and HitPos) then
|
||||
local FlameEmitter = ParticleEmitter(StartPos)
|
||||
--Amount of particles to create
|
||||
for i=0, 8 do
|
||||
if (!FlameEmitter) then return end
|
||||
|
||||
--Pool of flame sprites
|
||||
local FlameMat = {}
|
||||
FlameMat[1] = "effects/muzzleflash2"
|
||||
FlameMat[2] = "effects/muzzleflash2edit"
|
||||
FlameMat[3] = "effects/muzzleflash3"
|
||||
|
||||
local FlameParticle = FlameEmitter:Add(FlameMat[math.random(1,3)], StartPos)
|
||||
|
||||
if (math.random(1,16) == 16) then
|
||||
FlameParticle = FlameEmitter:Add("sprites/heatwave", StartPos)
|
||||
end
|
||||
|
||||
if (FlameParticle) then
|
||||
FlameParticle:SetVelocity(((HitPos - StartPos):GetNormal() * math.random(1720,1820)) + (VectorRand() * math.random(142,172)))
|
||||
FlameParticle:SetLifeTime(0)
|
||||
FlameParticle:SetDieTime(0.52)
|
||||
FlameParticle:SetStartAlpha(math.random(92,132))
|
||||
FlameParticle:SetEndAlpha(0)
|
||||
FlameParticle:SetStartSize(math.random(4,6))
|
||||
FlameParticle:SetEndSize(math.random(32,52))
|
||||
FlameParticle:SetRoll(math.Rand(-360, 360))
|
||||
FlameParticle:SetRollDelta(math.Rand(-7.2, 7.2))
|
||||
FlameParticle:SetAirResistance(math.random(128, 256))
|
||||
FlameParticle:SetCollide(true)
|
||||
FlameParticle:SetGravity(Vector(0, 0, 64))
|
||||
end
|
||||
end
|
||||
FlameEmitter:Finish()
|
||||
|
||||
local SmokeEmitter = ParticleEmitter(StartPos)
|
||||
--Amount of particles to create
|
||||
for i=0, 2 do
|
||||
if (!SmokeEmitter) then return end
|
||||
|
||||
SmokeParticle = SmokeEmitter:Add("particle/smokesprites_000" .. math.random(1,8) .. "", StartPos)
|
||||
|
||||
if (SmokeParticle) then
|
||||
SmokeParticle:SetVelocity(((HitPos - StartPos):GetNormal() * math.random(1720,1820)) + (VectorRand() * math.random(152,182)))
|
||||
SmokeParticle:SetLifeTime(0)
|
||||
SmokeParticle:SetDieTime(math.Rand(0.92, 1.72))
|
||||
SmokeParticle:SetStartAlpha(math.random(52,92))
|
||||
SmokeParticle:SetEndAlpha(0)
|
||||
SmokeParticle:SetStartSize(math.random(8,10))
|
||||
SmokeParticle:SetEndSize(math.random(62,82))
|
||||
SmokeParticle:SetRoll(math.Rand(-360, 360))
|
||||
SmokeParticle:SetRollDelta(math.Rand(-5.2, 5.2))
|
||||
SmokeParticle:SetAirResistance(math.random(132, 262))
|
||||
SmokeParticle:SetCollide(true)
|
||||
SmokeParticle:SetGravity(Vector(0, 0, -92))
|
||||
SmokeParticle:SetLighting(1)
|
||||
end
|
||||
end
|
||||
SmokeEmitter:Finish()
|
||||
end
|
||||
end
|
||||
|
||||
--Kill effect
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
--Unused
|
||||
function EFFECT:Render() end
|
||||
@@ -0,0 +1,254 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
resource.AddFile("materials/effects/muzzleflash2edit.vtf")
|
||||
resource.AddFile("materials/effects/muzzleflash2edit.vmt")
|
||||
|
||||
SWEP.Author = "Draco_2k"
|
||||
SWEP.Category = "HL2RP"
|
||||
SWEP.Purpose = "Set stuff on fire"
|
||||
SWEP.Instructions = "Left-Click: Fire\nReload: Regenerate Ammunition"
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminSpawnable = true
|
||||
|
||||
SWEP.ViewModel = "models/weapons/v_physcannon.mdl"
|
||||
SWEP.WorldModel = ""
|
||||
|
||||
SWEP.UseHands = false
|
||||
SWEP.IsAlwaysRaised = true
|
||||
SWEP.HoldType = "normal"
|
||||
SWEP.AnimPrefix = "normal"
|
||||
SWEP.PrintName = "Immolator"
|
||||
SWEP.DrawAmmo = false
|
||||
SWEP.Primary.Automatic = true
|
||||
SWEP.Primary.ClipSize = -1
|
||||
SWEP.Primary.DefaultClip = -1
|
||||
SWEP.Primary.Ammo = "none"
|
||||
SWEP.Secondary.ClipSize = 75
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = true
|
||||
SWEP.Secondary.Ammo = "ar2"
|
||||
SWEP.Slot = 3
|
||||
SWEP.SlotPos = 3
|
||||
|
||||
SWEP.ReloadDelay = 0
|
||||
|
||||
--Precache everything
|
||||
function SWEP:Precache()
|
||||
util.PrecacheSound("ambient/machines/keyboard2_clicks.wav")
|
||||
|
||||
util.PrecacheSound("ambient/machines/thumper_dust.wav")
|
||||
util.PrecacheSound("ambient/fire/mtov_flame2.wav")
|
||||
util.PrecacheSound("ambient/fire/ignite.wav")
|
||||
|
||||
util.PrecacheSound("vehicles/tank_readyfire1.wav")
|
||||
end
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType(self.HoldType)
|
||||
end
|
||||
|
||||
-- luacheck: globals ACT_VM_FISTS_DRAW ACT_VM_FISTS_HOLSTER
|
||||
ACT_IDLE = 1
|
||||
|
||||
function SWEP:Holster()
|
||||
if (!IsValid(self.Owner)) then
|
||||
return
|
||||
end
|
||||
|
||||
local viewModel = self.Owner:GetViewModel()
|
||||
|
||||
if (IsValid(viewModel)) then
|
||||
viewModel:SetPlaybackRate(1)
|
||||
viewModel:ResetSequence(ACT_IDLE)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:ShouldDrawViewModel()
|
||||
return false
|
||||
end
|
||||
|
||||
--Primary attack
|
||||
function SWEP:PrimaryAttack()
|
||||
if (SERVER) then
|
||||
if (self.Owner:GetAmmoCount("ar2") < 1 or self.ReloadDelay == 1) then
|
||||
self:RunoutReload()
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if (self.Owner:GetAmmoCount("ar2") > 0 and self.ReloadDelay == 0) then
|
||||
self.Owner:RemoveAmmo(1, self.Weapon:GetSecondaryAmmoType())
|
||||
self.Owner:MuzzleFlash()
|
||||
self.Weapon:SetNextPrimaryFire(CurTime() + 0.08)
|
||||
|
||||
if (SERVER) then
|
||||
local trace = self.Owner:GetEyeTrace()
|
||||
local Distance = self.Owner:GetPos():Distance(trace.HitPos)
|
||||
|
||||
if (Distance < 520) then
|
||||
--This is how we ignite stuff
|
||||
local Ignite = function()
|
||||
--Safeguard
|
||||
if (!self:IsValid()) then return end
|
||||
|
||||
--Damage things in radius of impact
|
||||
local flame = ents.Create("point_hurt")
|
||||
flame:SetPos(trace.HitPos)
|
||||
flame:SetOwner(self.Owner)
|
||||
flame:SetKeyValue("DamageRadius",128)
|
||||
flame:SetKeyValue("Damage",4)
|
||||
flame:SetKeyValue("DamageDelay",0.32)
|
||||
flame:SetKeyValue("DamageType",8)
|
||||
flame:Spawn()
|
||||
flame:Fire("TurnOn","",0)
|
||||
flame:Fire("kill","",0.72)
|
||||
|
||||
if (trace.HitWorld) then
|
||||
--Create actual fire - doesn't work very well in practice
|
||||
local fire = ents.Create("env_fire")
|
||||
|
||||
fire:SetPos(trace.HitPos + Vector(0, 0, -8))
|
||||
fire:SetAngles(Angle(0,0, math.random(-360, 360)))
|
||||
fire:SetKeyValue("health", 10)
|
||||
fire:SetKeyValue("firesize", math.random(82, 128))
|
||||
fire:SetKeyValue("fireattack", tostring(math.random(0.72, 1.32)))
|
||||
fire:SetKeyValue("damagescale", 8)
|
||||
fire:SetKeyValue("spawnflags","178") --162
|
||||
fire:Spawn()
|
||||
fire:Activate()
|
||||
fire:Fire("StartFire","", 0)
|
||||
|
||||
local nearbystuff = ents.FindInSphere(trace.HitPos, 100)
|
||||
|
||||
for _, stuff in pairs(nearbystuff) do
|
||||
if (stuff != self.Owner) then
|
||||
if (stuff:GetPhysicsObject():IsValid()) then
|
||||
stuff:Ignite(5, 100)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (trace.Entity:IsValid()) then
|
||||
if (trace.Entity:GetPhysicsObject():IsValid()) then
|
||||
trace.Entity:Ignite(5, 100)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Ignite stuff; based on how long it takes for flame to reach it
|
||||
timer.Simple(Distance/1520, Ignite)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Unused
|
||||
function SWEP:SecondaryAttack() end
|
||||
|
||||
--Play a nice sound on deployment
|
||||
function SWEP:Deploy()
|
||||
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
|
||||
|
||||
if (SERVER) then
|
||||
self.Owner:EmitSound("ambient/machines/keyboard2_clicks.wav", 42, 100)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
--Think function
|
||||
function SWEP:Think()
|
||||
if (SERVER) then
|
||||
if (self.Owner:KeyReleased(IN_ATTACK) and (self.Owner:GetAmmoCount("ar2") > 1) and (self.ReloadDelay != 1)) then
|
||||
self.Owner:EmitSound("ambient/fire/mtov_flame2.wav", 24, 100)
|
||||
end
|
||||
|
||||
if (self.Owner:GetAmmoCount("ar2") > 0 and self.ReloadDelay == 0) then
|
||||
if (self.Owner:KeyPressed(IN_ATTACK)) then
|
||||
self.Owner:EmitSound("ambient/machines/thumper_dust.wav", 46, 100)
|
||||
end
|
||||
|
||||
if (self.Owner:KeyDown(IN_ATTACK)) then
|
||||
self.Owner:EmitSound("ambient/fire/mtov_flame2.wav", math.random(27, 35), math.random(32, 152))
|
||||
|
||||
local trace = self.Owner:GetEyeTrace()
|
||||
local flamefx = EffectData()
|
||||
|
||||
flamefx:SetOrigin(trace.HitPos)
|
||||
flamefx:SetStart(self.Owner:GetShootPos())
|
||||
flamefx:SetAttachment(1)
|
||||
flamefx:SetEntity(self.Weapon)
|
||||
|
||||
util.Effect("swep_flamethrower_flame", flamefx, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Reload function
|
||||
function SWEP:Reload()
|
||||
if (self.Owner:GetAmmoCount("ar2") > 74 or self.ReloadDelay == 1) then return end
|
||||
|
||||
self.ReloadDelay = 1
|
||||
|
||||
if (SERVER) then
|
||||
self.Owner:EmitSound("vehicles/tank_readyfire1.wav", 30, 100)
|
||||
end
|
||||
|
||||
timer.Simple(1.82, function()
|
||||
if (self:IsValid()) then
|
||||
self:ReloadSelf()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--How to reload if running out of ammo
|
||||
function SWEP:RunoutReload()
|
||||
if (self.Owner:GetAmmoCount("ar2") > 74 or self.ReloadDelay == 1) then return end
|
||||
|
||||
self.ReloadDelay = 1
|
||||
|
||||
if (SERVER) then
|
||||
self.Owner:EmitSound("ambient/machines/thumper_dust.wav", 48, 100)
|
||||
self.Owner:EmitSound("vehicles/tank_readyfire1.wav", 30, 100)
|
||||
end
|
||||
|
||||
timer.Simple(1.82, function()
|
||||
if (self:IsValid()) then
|
||||
self:ReloadSelf()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--Finish reloading
|
||||
function SWEP:ReloadSelf()
|
||||
--Safeguards
|
||||
if (!self or !self:IsValid()) then return end
|
||||
|
||||
if (SERVER) then
|
||||
local ammo = math.Clamp((75 - self.Owner:GetAmmoCount("ar2")), 0, 75)
|
||||
|
||||
self.Owner:GiveAmmo(ammo, "ar2")
|
||||
end
|
||||
|
||||
self.ReloadDelay = 0
|
||||
|
||||
if (self.Owner:KeyDown(IN_ATTACK)) then
|
||||
if (SERVER) then
|
||||
self.Owner:EmitSound("ambient/machines/thumper_dust.wav", 46, 100)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
FACTION.name = "Cremator"
|
||||
FACTION.description = "A Combine janitor of sorts"
|
||||
FACTION.color = Color(83, 51, 3)
|
||||
FACTION.isDefault = false
|
||||
FACTION.runSounds = {[0] = "npc/cremator/foot1.wav", [1] = "npc/cremator/foot2.wav", [3] = "npc/cremator/foot3.wav"}
|
||||
FACTION.models = {"models/wn7new/combine_cremator/cremator.mdl"}
|
||||
FACTION.factionImage = "willardnetworks/faction_imgs/cremator.png"
|
||||
FACTION.selectImage = "willardnetworks/faction_imgs/cremator.png"
|
||||
FACTION.inventoryImage = "materials/willardnetworks/tabmenu/inventory/backgrounds/nexus.png"
|
||||
FACTION.noAppearances = true
|
||||
FACTION.noAttributes = true
|
||||
FACTION.noBackground = true
|
||||
FACTION.noBeard = true
|
||||
FACTION.noGender = true
|
||||
FACTION.noGenetics = true
|
||||
FACTION.ReadOptionDisabled = true
|
||||
FACTION.isGloballyRecognized = true
|
||||
|
||||
FACTION.noNeeds = true
|
||||
FACTION.noGas = true
|
||||
FACTION.noTBC = true
|
||||
|
||||
FACTION.isCombineFaction = true
|
||||
|
||||
FACTION.canSeeWaypoints = true
|
||||
FACTION.canAddWaypoints = true
|
||||
FACTION.canRemoveWaypoints = true
|
||||
FACTION.canUpdateWaypoints = true
|
||||
|
||||
FACTION.allLanguages = true
|
||||
FACTION.allowForcefieldControl = true
|
||||
FACTION.allowCIDCreator = true
|
||||
FACTION.allowEnableRations = true
|
||||
FACTION.allowCombineDoors = true
|
||||
FACTION.allowCombineLock = true
|
||||
FACTION.alwaysFlashlight = true
|
||||
FACTION.alwaysDatafile = true
|
||||
FACTION.canHearRequests = true
|
||||
FACTION.noSmuggler = true
|
||||
FACTION.noGenDesc = true
|
||||
|
||||
FACTION.npcRelations = {
|
||||
["npc_combine_camera"] = D_LI,
|
||||
["npc_turret_ceiling"] = D_LI,
|
||||
["npc_cscanner"] = D_LI,
|
||||
["npc_manhack"] = D_LI,
|
||||
["npc_rollermine"] = D_LI,
|
||||
["npc_clawscanner"] = D_LI,
|
||||
["npc_turret_floor"] = D_LI,
|
||||
["npc_metropolice"] = D_LI,
|
||||
["npc_combinedropship"] = D_LI,
|
||||
["CombineElite"] = D_LI,
|
||||
["npc_combinegunship"] = D_LI,
|
||||
["npc_combine_s"] = D_LI,
|
||||
["npc_hunter"] = D_LI,
|
||||
["npc_helicopter"] = D_LI,
|
||||
["CombinePrison"] = D_LI,
|
||||
["PrisonShotgunner"] = D_LI,
|
||||
["ShotgunSoldier"] = D_LI,
|
||||
["npc_stalker"] = D_LI,
|
||||
["npc_strider"] = D_LI
|
||||
}
|
||||
|
||||
function FACTION:GetDefaultName(client)
|
||||
return "C24.CREMATOR:" .. Schema:ZeroNumber(math.random(100, 999), 3), true
|
||||
end
|
||||
|
||||
function FACTION:OnTransfered(client)
|
||||
local character = client:GetCharacter()
|
||||
|
||||
character:SetName(self:GetDefaultName())
|
||||
character:SetModel(self.models[1])
|
||||
end
|
||||
|
||||
FACTION_CREMATOR = FACTION.index
|
||||
61
gamemodes/ixhl2rp/plugins/wncremator/sh_plugin.lua
Normal file
61
gamemodes/ixhl2rp/plugins/wncremator/sh_plugin.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
PLUGIN.name = "Cremator"
|
||||
PLUGIN.author = "DrodA & Aspect™"
|
||||
PLUGIN.description = "Adds a cremator faction."
|
||||
|
||||
ix.util.Include("cl_hooks.lua")
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
|
||||
game.AddParticles("particles/fire_01.pcf")
|
||||
game.AddParticles("particles/burning_fx.pcf")
|
||||
|
||||
PrecacheParticleSystem("fire_jet_01_flame")
|
||||
PrecacheParticleSystem("burning_character_c") -- burning_character_e
|
||||
|
||||
ix.anim.cremator = {
|
||||
normal = {
|
||||
[ACT_MP_STAND_IDLE] = {ACT_IDLE, ACT_IDLE},
|
||||
[ACT_MP_WALK] = {ACT_WALK, ACT_WALK},
|
||||
[ACT_MP_RUN] = {ACT_WALK, ACT_WALK},
|
||||
[ACT_LAND] = {ACT_IDLE, ACT_IDLE},
|
||||
[ACT_MP_CROUCH_IDLE] = {ACT_IDLE, ACT_IDLE},
|
||||
[ACT_MP_CROUCHWALK] = {ACT_WALK, ACT_WALK}
|
||||
},
|
||||
glide = ACT_IDLE
|
||||
}
|
||||
|
||||
ix.anim.SetModelClass("models/wn7new/combine_cremator/cremator.mdl", "cremator")
|
||||
|
||||
local movementBlacklist = {
|
||||
-- [IN_JUMP] = true,
|
||||
[IN_SPEED] = true,
|
||||
[IN_RUN] = true,
|
||||
[IN_WALK] = true,
|
||||
-- [IN_DUCK] = true
|
||||
}
|
||||
|
||||
function PLUGIN:SetupMove(client, moveData, cmd)
|
||||
if (client:Team() == FACTION_CREMATOR and client:GetMoveType() != MOVETYPE_NOCLIP) then
|
||||
for key, _ in pairs(movementBlacklist) do
|
||||
if (moveData:KeyDown(key)) then
|
||||
moveData:SetButtons(bit.band(moveData:GetButtons(), bit.bnot(key)))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:InitializedPlugins()
|
||||
if (ix.plugin.list.inventoryslosts and FACTION_CREMATOR) then
|
||||
ix.plugin.list.inventoryslots.noEquipFactions[FACTION_CREMATOR] = true
|
||||
end
|
||||
end
|
||||
144
gamemodes/ixhl2rp/plugins/wncremator/sv_hooks.lua
Normal file
144
gamemodes/ixhl2rp/plugins/wncremator/sv_hooks.lua
Normal file
@@ -0,0 +1,144 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
game.AddParticles("particles/fire_01.pcf")
|
||||
PrecacheParticleSystem("fire_jet_01_flame")
|
||||
|
||||
util.PrecacheSound("ambient/explosions/explode_8.wav")
|
||||
|
||||
function PLUGIN:PostPlayerLoadout(client)
|
||||
if (client:Team() == FACTION_CREMATOR and client:GetCharacter()) then
|
||||
client:SetWalkSpeed(50)
|
||||
client:SetRunSpeed(70)
|
||||
client:SetHealth(300)
|
||||
client:SetMaxHealth(300)
|
||||
|
||||
client:StripWeapon("ix_keys")
|
||||
|
||||
client:Give("immolator")
|
||||
client:SelectWeapon("immolator")
|
||||
|
||||
client:SetNetVar("fuelTankHealth", 1)
|
||||
client:SetNetVar("fuelTankWasExploded", nil)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:GetPlayerPainSound(client)
|
||||
if (client:Team() == FACTION_CREMATOR) then
|
||||
return "npc/cremator/alert_object.wav"
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:GetPlayerDeathSound(client)
|
||||
if (client:Team() == FACTION_CREMATOR) then
|
||||
return "npc/cremator/crem_die.wav"
|
||||
end
|
||||
end
|
||||
|
||||
local walkSounds = {"npc/cremator/foot1.wav", "npc/cremator/foot2.wav", "npc/cremator/foot3.wav"}
|
||||
|
||||
function PLUGIN:PlayerFootstep(client, position, foot, soundName, volume)
|
||||
if (client:Team() == FACTION_CREMATOR) then
|
||||
client:EmitSound(walkSounds[math.random(1, #walkSounds)])
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local fuelTankBone = "Bip01 Spine2"
|
||||
|
||||
local radius = 200
|
||||
local magnitude = 10
|
||||
|
||||
local fireTrailSeconds = 5
|
||||
|
||||
function PLUGIN:PlayerTraceAttack(client, damageInfo, vector, trace)
|
||||
if (client:Team() == FACTION_CREMATOR) then
|
||||
local fuelTankHealth = client:GetNetVar("fuelTankHealth", 0)
|
||||
|
||||
local bone = trace.HitBoxBone
|
||||
|
||||
if (client:GetBoneName(bone) == fuelTankBone) then
|
||||
if (client:GetNetVar("fuelTankWasExploded")) then return end
|
||||
|
||||
if (fuelTankHealth > 0) then
|
||||
client:SetNetVar("fuelTankHealth", fuelTankHealth - damageInfo:GetDamage())
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local timerId = "ixCrematorTankExplodeTimer_" .. client:EntIndex()
|
||||
|
||||
if (timer.Exists(timerId)) then return end
|
||||
|
||||
local matrix = client:GetBoneMatrix(bone)
|
||||
local position = matrix:GetTranslation()
|
||||
local angles = matrix:GetAngles()
|
||||
|
||||
local fireTrail = ents.Create( "info_particle_system" )
|
||||
fireTrail:SetKeyValue("effect_name", "fire_jet_01_flame")
|
||||
fireTrail:SetKeyValue("start_active", "1")
|
||||
fireTrail:SetPos(position)
|
||||
fireTrail:SetAngles(angles)
|
||||
fireTrail:SetParent(client)
|
||||
fireTrail:Spawn()
|
||||
fireTrail:Activate()
|
||||
fireTrail:Fire("Kill", nil, fireTrailSeconds)
|
||||
|
||||
client:SetNetVar("fuelTankWasExploded", true)
|
||||
|
||||
timer.Create(timerId, fireTrailSeconds, 1, function()
|
||||
if (!IsValid(client)) then return end
|
||||
|
||||
local playerPosition = client:GetPos()
|
||||
|
||||
local effect = EffectData()
|
||||
effect:SetStart(playerPosition)
|
||||
effect:SetOrigin(playerPosition)
|
||||
effect:SetScale(2)
|
||||
effect:SetRadius(radius)
|
||||
effect:SetMagnitude(magnitude)
|
||||
|
||||
util.Effect("Explosion", effect, true, true)
|
||||
util.Effect("HelicopterMegaBomb", effect, true, true)
|
||||
|
||||
local explode = ents.Create("info_particle_system")
|
||||
explode:SetKeyValue("effect_name", "hl2r_explosion_rpg")
|
||||
explode:SetOwner(client)
|
||||
explode:SetPos(playerPosition)
|
||||
explode:Spawn()
|
||||
explode:Activate()
|
||||
explode:Fire("start", "", 0)
|
||||
explode:Fire("kill", "", 30)
|
||||
|
||||
local blastDamage = DamageInfo()
|
||||
blastDamage:SetInflictor(client)
|
||||
blastDamage:SetAttacker(client)
|
||||
blastDamage:SetDamage(80)
|
||||
blastDamage:SetDamageType(bit.bor(DMG_BLAST, DMG_AIRBOAT))
|
||||
|
||||
util.BlastDamageInfo(blastDamage, playerPosition, radius)
|
||||
|
||||
local explosion = ents.Create("env_physexplosion")
|
||||
explosion:SetPos(playerPosition)
|
||||
explosion:SetKeyValue("magnitude", magnitude)
|
||||
explosion:SetKeyValue("radius", radius)
|
||||
explosion:SetKeyValue("spawnflags", "19")
|
||||
explosion:Spawn()
|
||||
explosion:Fire("Explode", "", 0)
|
||||
|
||||
client:ForceSequence("Flich01")
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user