add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -0,0 +1,47 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/maxofs2d/button_02.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end
function ENT:Use( a, c )
local team = c:Team() or 0
if ConfigurationMedicMod.OnlyMedicCanUseVehicleButton and not table.HasValue( ConfigurationMedicMod.MedicTeams, team ) then return end
if not IsValid(self:GetParent()) then self:Remove() return end
local amb = self:GetParent()
if not ConfigurationMedicMod.Vehicles[amb:GetModel()] then self:Remove() return end
if not IsValid( amb.Stretcher ) then return end
local stretcher = amb.Stretcher
stretcher:SetParent( nil )
stretcher:SetPos(amb:LocalToWorld(ConfigurationMedicMod.Vehicles[amb:GetModel()].backPos))
stretcher:SetColor(Color(255,255,255,255))
amb.Stretcher = nil
amb.SpawnedStretcher = stretcher
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Button"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = false

View File

@@ -0,0 +1,63 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
if not self:GetProduct1() or not self:GetProduct2() or not self:GetProduct3() then return end
local dist = LocalPlayer():GetPos():Distance(self:GetPos())
if dist > 500 then return end
local angle = self.Entity:GetAngles()
local position = self.Entity:GetPos() + angle:Forward() * -7 + angle:Up() * 5
local position2 = self.Entity:GetPos() + angle:Forward() * 0 + angle:Up() * 5
angle:RotateAroundAxis(angle:Forward(), 90);
angle:RotateAroundAxis(angle:Right(),90);
angle:RotateAroundAxis(angle:Up(), 0);
local color1 = Color(0,0,0,200)
local color2 = Color(0,0,0,200)
local color3 = Color(0,0,0,200)
local font1 = "MedicModFont15"
local font2 = "MedicModFont15"
local font3 = "MedicModFont15"
if string.len(self:GetProduct1()) > 12 then
font1 = "MedicModFont10"
end
if string.len(self:GetProduct2()) > 12 then
font2 = "MedicModFont10"
end
if string.len(self:GetProduct3()) > 12 then
font3 = "MedicModFont10"
end
if self:GetProduct1() != ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then
color1 = Color(ConfigurationMedicMod.Reagents[self:GetProduct1()].color.r,ConfigurationMedicMod.Reagents[self:GetProduct1()].color.g,ConfigurationMedicMod.Reagents[self:GetProduct1()].color.b,200)
end
if self:GetProduct2() != ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then
color2 = Color(ConfigurationMedicMod.Reagents[self:GetProduct2()].color.r,ConfigurationMedicMod.Reagents[self:GetProduct2()].color.g,ConfigurationMedicMod.Reagents[self:GetProduct2()].color.b,200)
end
if self:GetProduct3() != ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then
color3 = Color(ConfigurationMedicMod.Reagents[self:GetProduct3()].color.r,ConfigurationMedicMod.Reagents[self:GetProduct3()].color.g,ConfigurationMedicMod.Reagents[self:GetProduct3()].color.b,200)
end
cam.Start3D2D(position, angle, 0.2)
draw.RoundedBox( 0, -40, -24, 80, 15, color1 )
draw.RoundedBox( 0, -40, -24 + 16, 80, 15, color2 )
draw.RoundedBox( 0, -40, -24 + 32, 80, 15, color3 )
draw.SimpleTextOutlined(self:GetProduct1(), font1 ,0,-17.5, Color(255,255,255,255), 1, 1, 0.5, Color(0,0,0,255))
draw.SimpleTextOutlined(self:GetProduct2(), font2 ,0,-17.5 + 16, Color(255,255,255,255), 1, 1, 0.5, Color(0,0,0,255))
draw.SimpleTextOutlined(self:GetProduct3(), font3 ,0,-17.5 + 32, Color(255,255,255,255), 1, 1, 0.5, Color(0,0,0,255))
cam.End3D2D()
end

View File

@@ -0,0 +1,58 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/beaker/beaker.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
self.NextTouch = 0
self:SetProduct1(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
self:SetProduct2(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
self:SetProduct3(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
end
function ENT:Touch( ent )
if self.NextTouch > CurTime() then return end
self.NextTouch = CurTime() + 1
if ent:GetClass() != "test_tube_medicmod" then return end
if self:GetProduct1() != ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] && self:GetProduct2() != ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] && self:GetProduct3() != ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then
return
end
if self:GetProduct1() == ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then
self:SetProduct1( ent:GetProduct() )
ent:Remove()
elseif self:GetProduct2() == ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then
self:SetProduct2( ent:GetProduct() )
ent:Remove()
elseif self:GetProduct3() == ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then
self:SetProduct3( ent:GetProduct() )
ent:Remove()
end
end
function ENT:Use()
self:SetProduct1(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
self:SetProduct2(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
self:SetProduct3(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
end

View File

@@ -0,0 +1,12 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Beaker"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true
function ENT:SetupDataTables()
self:NetworkVar("String", 0, "Product1")
self:NetworkVar("String", 1, "Product2")
self:NetworkVar("String", 2, "Product3")
end

View File

@@ -0,0 +1,8 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -0,0 +1,130 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/hospital_bed/hospital_bed.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:StartMotionController()
self.ShadowParams = {}
end
function ENT:PhysicsSimulate( phys, deltatime )
phys:Wake()
self.ShadowParams.secondstoarrive = 0.1
self.ShadowParams.angle = Angle( 0, self:GetAngles().yaw, 0 )
self.ShadowParams.maxangular = 5000
self.ShadowParams.maxangulardamp = 10000
phys:ComputeShadowControl( self.ShadowParams )
end
local boneAngles = {
[1] = {
bone = "ValveBiped.Bip01_R_Foot",
ang = Angle(0,0,0)
},
[2] = {
bone = "ValveBiped.Bip01_L_Foot",
ang = Angle(-0,0,0)
},
[3] = {
bone = "ValveBiped.Bip01_R_ForeArm",
ang = Angle(-20,0,0)
},
[4] = {
bone = "ValveBiped.Bip01_L_ForeArm",
ang = Angle(20,0,0)
},
[5] = {
bone = "ValveBiped.Bip01_L_UpperArm",
ang = Angle(20,-0,0)
},
[6] = {
bone = "ValveBiped.Bip01_R_UpperArm",
ang = Angle(-20,-0,0)
},
[7] = {
bone = "ValveBiped.Bip01_Head1",
ang = Angle(20,0,45)
},
}
function ENT:CreateDeathRagdoll( ply )
local ragdoll = ents.Create("prop_physics")
ragdoll:SetPos(self:GetPos()+self:GetAngles():Up() * 14+self:GetAngles():Right()*-22)
ragdoll:SetAngles(Angle(-90,self:GetAngles().Yaw,90))
ragdoll:SetModel(ply:GetModel())
ragdoll:Spawn()
ragdoll:SetParent(self)
for _, inf in pairs( boneAngles ) do
local bone = ragdoll:LookupBone(inf.bone)
if bone then
ragdoll:ManipulateBoneAngles(bone, inf.ang)
end
end
ragdoll:SetOwner( ply )
ragdoll:SetDeathRagdoll( true )
-- Set the view on the ragdoll
ply:Spectate( OBS_MODE_CHASE )
ply:SpectateEntity( ragdoll )
return ragdoll
end
function ENT:Touch( ent )
self.nexttouch = self.nexttouch or 0
if self.nexttouch > CurTime() then return end
self.nexttouch = CurTime() + 1
if self.ragdoll && IsValid( self.ragdoll ) then return end
local rag
local typer
if ent:IsDeathRagdoll() then
rag = ent
typer = 1
elseif IsValid(ent.ragdoll) && ent.ragdoll:IsDeathRagdoll() then
rag = ent.ragdoll
typer = 2
else
return
end
if not IsValid( rag:GetOwner() ) then return end
local ply = rag:GetOwner()
self.ragdoll = self:CreateDeathRagdoll( ply )
ply.DeathRagdoll = self.ragdoll
rag:Remove()
end
function ENT:OnRemove()
if IsValid( self.Stand ) then
self.Stand.Bed = nil
end
if IsValid( self.ragdoll ) then
self.ragdoll:Remove()
end
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Bed"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true

View File

@@ -0,0 +1,42 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
local dist = LocalPlayer():GetPos():Distance(self:GetPos())
if dist > 500 then return end
local angle = self.Entity:GetAngles()
local position = self.Entity:GetPos()
angle:RotateAroundAxis(angle:Forward(), 0);
angle:RotateAroundAxis(angle:Right(),0);
angle:RotateAroundAxis(angle:Up(), 90);
cam.Start3D2D(position, angle, 0.2)
local blood = self:GetBlood()
local bloodqt = math.Clamp(blood/100,0,1)
local round
if blood < 40 && blood > 20 then
round = 5
elseif blood <= 20 && blood > 10 then
round = 3
elseif blood <= 10 then
round = 0
elseif blood >= 40 then
round = 8
end
draw.RoundedBox( round, -13,16 - 32* bloodqt, 26, 35 * bloodqt, Color(150,0,0) )
draw.SimpleTextOutlined(blood.."%", "MedicModFont15" ,0,0, Color(255,255,255,255), 1, 1, 0.5, Color(0,0,0))
cam.End3D2D()
end

View File

@@ -0,0 +1,34 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/bloodbag/bloodbag.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
self:SetBlood(100)
self:SetBodygroup( 0,1 )
end
function ENT:OnRemove()
if IsValid( self.Stand ) then
self.Stand.BloodBag = nil
end
end

View File

@@ -0,0 +1,10 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Bloodbag"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true
function ENT:SetupDataTables()
self:NetworkVar("Int", 0, "Blood")
end

View File

@@ -0,0 +1,73 @@
include("shared.lua")
local materialBackground = Material("materials/medical_background_white.jpg")
local body1 = Material("materials/body.png")
local body2 = Material("materials/body_left_arm.png")
local body3 = Material("materials/body_right_arm.png")
local body4 = Material("materials/body_left_leg.png")
local body5 = Material("materials/body_right_leg.png")
local sentences = ConfigurationMedicMod.Sentences
local lang = ConfigurationMedicMod.Language
local posx = 0-20
function ENT:Draw()
self:DrawModel()
local radio = self:GetParent()
if not radio then return end
local angle = self:GetAngles()
local pos = self:GetPos() + angle:Right() * 27.9 + angle:Forward() * 6+ angle:Up() * 35.5
local ang = self:GetAngles()
ang:RotateAroundAxis(ang:Forward(), 0);
ang:RotateAroundAxis(ang:Right(),-90);
ang:RotateAroundAxis(ang:Up(), 90);
cam.Start3D2D( pos, ang, 0.282)
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( materialBackground )
surface.DrawTexturedRect( 0 ,0, 852/4 - 10, 480/4 )
-- draw.RoundedBox( 0, 0,0,500/9,901/9, Color(255,255,255,255))
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( body1 )
surface.DrawTexturedRect( (852/4 - 10)/2 - (500/9)/2 , (480/4)/2 - (901/9)/2 , 500/9,901/9 )
if radio.fracturesTable then
if radio.fracturesTable[HITGROUP_LEFTLEG] then
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( body4 )
surface.DrawTexturedRect( (852/4 - 10)/2 - (500/9)/2 , (480/4)/2 - (901/9)/2 , 500/9,901/9)
end
if radio.fracturesTable[HITGROUP_RIGHTLEG] then
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( body5 )
surface.DrawTexturedRect( (852/4 - 10)/2 - (500/9)/2 , (480/4)/2 - (901/9)/2 , 500/9,901/9 )
end
if radio.fracturesTable[HITGROUP_LEFTARM] then
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( body2 )
surface.DrawTexturedRect( (852/4 - 10)/2 - (500/9)/2 , (480/4)/2 - (901/9)/2 , 500/9,901/9)
end
if radio.fracturesTable[HITGROUP_RIGHTARM] then
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( body3 )
surface.DrawTexturedRect((852/4 - 10)/2 - (500/9)/2 , (480/4)/2 - (901/9)/2 , 500/9,901/9)
end
end
cam.End3D2D()
end
function ENT:OnRemove()
if not BaseFrame then return end
if not ispanel( BaseFrame ) then return end
BaseFrame:Remove()
end

View File

@@ -0,0 +1,22 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/props_phx/rt_screen.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Radio - Screen"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = false

View File

@@ -0,0 +1,8 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -0,0 +1,188 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/medical_stand/medical_stand.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end
function ENT:AttachBloodBag( bag )
bag:SetPos( self:GetPos() + self:GetAngles():Up() * 72.2 + self:GetAngles():Right() * 10 + self:GetAngles():Forward() * 2.4 )
bag:SetAngles( self:GetAngles() + Angle(90,0,90) )
bag:SetParent( self )
end
function ENT:Touch( ent )
if ent:GetClass() == "bloodbag_medicmod" then
if IsValid(self.BloodBag) then return end
if IsValid(ent.Stand) then return end
self:AttachBloodBag( ent )
ent.Stand = self
self.BloodBag = ent
return
end
if ent:GetClass() == "bed_medicmod" then
if IsValid( self.Bed ) then return end
if IsValid( ent.Stand ) then return end
if not IsValid( self.BloodBag ) then return end
if not IsValid( ent.ragdoll ) or not ent.ragdoll:IsDeathRagdoll() then return end
ent.Stand = self
self.Bed = ent
if timer.Exists( "StandBloodTime"..self:EntIndex() ) then
timer.Destroy( "StandBloodTime"..self:EntIndex() )
end
local rag = ent.ragdoll
local bed = ent
local ply = ent.ragdoll:GetOwner()
local bbag = self.BloodBag
timer.Create("StandBloodTime"..self:EntIndex(), 1, 0, function()
if not IsValid( rag ) or not IsValid( bed ) or not IsValid( ply ) or not IsValid( bbag ) or not IsValid( self ) then
if IsValid(self) then
self.Bed = nil
end
if IsValid( bed ) then
bed.Stand = nil
end
timer.Destroy("StandBloodTime"..self:EntIndex())
return
end
local dist = self:GetPos():Distance( bed:GetPos() )
local health = ply:Health()
local tadd = 2
local bblood = bbag:GetBlood()
if dist > 200 then self.Bed = nil bed.Stand = nil timer.Destroy("StandBloodTime"..self:EntIndex()) return end
if health < 0 then ply:SetHealth( 0 ) health = 0 end
if health >= ( 100 - tadd ) then
if health >= 100 then
if not ply:GetHeartAttack() then
ply:MedicalRespawn()
timer.Destroy("StandBloodTime"..self:EntIndex())
self.Bed = nil
bed.Stand = nil
if bbag:GetBlood() <= 0 then
bbag:Remove()
end
end
return
elseif bblood >= tadd then
if not ply:GetHeartAttack() then
bbag:SetBlood( bblood - health - 100 )
ply:SetHealth( 100 )
ply:MedicalRespawn()
timer.Destroy("StandBloodTime"..self:EntIndex())
self.Bed = nil
bed.Stand = nil
if bbag:GetBlood() <= 0 then
bbag:Remove()
end
end
return
else
ply:SetHealth( health + tadd )
bbag:Remove()
timer.Destroy("StandBloodTime"..self:EntIndex())
self.Bed = nil
bed.Stand = nil
return
end
end
if bblood - tadd <= 0 then
if bblood - tadd == 0 then
ply:SetHealth( health + tadd )
bbag:Remove()
timer.Destroy("StandBloodTime"..self:EntIndex())
self.Bed = nil
bed.Stand = nil
return
else
bbag:Remove()
timer.Destroy("StandBloodTime"..self:EntIndex())
self.Bed = nil
bed.Stand = nil
return
end
end
ply:SetHealth( health + tadd )
bbag:SetBlood( bblood - tadd )
end)
end
end
function ENT:Think()
if SERVER then
if not IsValid(self.Bed) and IsValid(self.BloodBag) then
for _, ent in ipairs(ents.FindInSphere(self:GetPos(), 100)) do
if ent:GetClass() == "bed_medicmod" and not IsValid(ent.Stand) then
if IsValid(ent.ragdoll) and ent.ragdoll:IsDeathRagdoll() then
self:Touch(ent)
break
end
end
end
end
end
self:NextThink(CurTime() + 2)
return true
end
function ENT:OnRemove()
if IsValid( self.Bed ) then
self.Bed.Stand = nil
end
if IsValid( self.BloodBag ) then
self.BloodBag.Stand = nil
end
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Drip"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true

View File

@@ -0,0 +1,29 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
if not self:GetDrug() then return end
local dist = LocalPlayer():GetPos():Distance(self:GetPos())
if dist > 500 then return end
local angle = self.Entity:GetAngles()
local position = self.Entity:GetPos() + angle:Forward() * 5 + angle:Up() * 20 + angle:Right() * 0
angle:RotateAroundAxis(angle:Forward(), 90);
angle:RotateAroundAxis(angle:Right(),-40);
angle:RotateAroundAxis(angle:Up(), 0);
cam.Start3D2D(position + angle:Right() * math.sin(CurTime() * 2), angle, 0.2)
draw.SimpleTextOutlined(self:GetDrug(), "MedicModFont15" ,-7,0, Color(255,255,255,255), 1, 1, 0.5, Color(0,0,0,255))
cam.End3D2D()
end

View File

@@ -0,0 +1,78 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/drug/drug.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
self:SetDrug(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
self.NextTouch = 0
end
function ENT:Touch( ent )
if self.NextTouch > CurTime() then return end
self.NextTouch = CurTime() + 1
if ent:GetClass() != "beaker_medicmod" then return end
if self:GetDrug() != ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then return end
local drug
for k, v in pairs( ConfigurationMedicMod.Drugs ) do
drug = k
for product, val in pairs( ConfigurationMedicMod.Drugs[k] ) do
if product == "func" or product == "price" or product == ent:GetProduct1() or product == ent:GetProduct2() or product == ent:GetProduct3() then
continue
else
drug = nil
break
end
end
if drug then break end
end
if not drug then return end
self:SetDrug( drug )
ent:SetProduct1(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
ent:SetProduct2(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
ent:SetProduct3(ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language])
end
function ENT:Use(a, c)
if self:GetDrug() == ConfigurationMedicMod.Sentences["Empty"][ConfigurationMedicMod.Language] then return end
ConfigurationMedicMod.Drugs[self:GetDrug()].func( c )
self:Remove()
end
function ENT:OnRemove()
if self.DrugSpawner and IsValid( self.DrugSpawner ) then
local drugsspawned = self.DrugSpawner.DrugsSpawned or 1
self.DrugSpawner.DrugsSpawned = drugsspawned - 1 or 0
end
end

View File

@@ -0,0 +1,10 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Drug"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true
function ENT:SetupDataTables()
self:NetworkVar("String", 0, "Drug")
end

View File

@@ -0,0 +1,7 @@
include("shared.lua")
function ENT:Draw()
--self:DrawModel()
end

View File

@@ -0,0 +1,60 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/props_junk/PopCan01a.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end
function ENT:Touch( ent )
if ent:GetClass() != "bed_medicmod" then return end
local bed = ent
local elec = self.Elec
if not elec or not IsValid(elec) then return end
if not bed.ragdoll or not IsValid( bed.ragdoll ) then return end
if not IsValid( bed.ragdoll:GetOwner() ) then return end
local ragdoll = bed.ragdoll
local ply = ragdoll:GetOwner()
local rope = self
local bone = ragdoll:LookupBone("ValveBiped.Bip01_Spine4")
if not bone then return end
local pos, ang = ragdoll:GetBonePosition( bone )
rope:SetPos( pos + ang:Right() * -4 )
rope:SetParent( ragdoll )
ragdoll.Rope = rope
elec:SetPatient( ply )
end
function ENT:OnRemove()
if IsValid( self.Elec ) then
self.Elec:Remove()
end
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Electrocardiogram - A"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = false

View File

@@ -0,0 +1,59 @@
include("shared.lua")
local matRate1 = Material("materials/heart_rate2.png")
local matRate2 = Material("materials/heart_rate1.png")
local matRate3 = Material("materials/heart_rate3.png")
local matWhiteBar = Material("materials/whitebar.png")
local matrate = matRate1
local posx = 0-20
function ENT:Draw()
self:DrawModel()
if IsValid(self:GetPatient()) then
if self:GetPatient():GetHeartAttack() then
matrate = matRate1
elseif self:GetPatient():Stable() then
matrate = matRate2
else
matrate = matRate3
end
local angle = self:GetAngles()
local pos = self:GetPos() + angle:Right() * 5 + angle:Forward() * 7.5+ angle:Up() * 2.5
local ang = self:GetAngles()
ang:RotateAroundAxis(ang:Forward(), 0);
ang:RotateAroundAxis(ang:Right(),-80);
ang:RotateAroundAxis(ang:Up(), 90);
cam.Start3D2D( pos, ang, 0.01)
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( matWhiteBar )
surface.DrawTexturedRect( posx ,0, 20, 380 )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( matrate )
surface.DrawTexturedRect( 0,0, 490, 380 )
cam.End3D2D()
if posx > 380-20 then
posx = 0-20
else
posx = posx + 1
end
end
end
function ENT:OnRemove()
if not BaseFrame then return end
if not ispanel( BaseFrame ) then return end
BaseFrame:Remove()
end

View File

@@ -0,0 +1,35 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/electrocardiogram/electrocardiogram.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
-- self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
local ent = ents.Create("electrocardiogram_att_medicmod")
ent:SetPos( self:GetPos() )
ent:Spawn()
local const, rope = constraint.Rope( self, ent, 0,0, Vector(0,6.5,0), Vector(0,0,0), 30, 0, 0, 1, "cable/cable_lit", true )
ent.Elec = self
self.Att = ent
end
function ENT:OnRemove()
if IsValid( self.Att ) then
self.Att:Remove()
end
end

View File

@@ -0,0 +1,10 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Electrocardiogram"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true
function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "Patient")
end

View File

@@ -0,0 +1,7 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -0,0 +1,65 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/firstaidkit/firstaidkit.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
self.Content = {
["bandage"] = 3,
["syringe_antidote"] = 1,
["syringe_morphine"] = 2,
}
end
local sentences = ConfigurationMedicMod.Sentences
local lang = ConfigurationMedicMod.Language
function ENT:Use( activator, ply )
if ply:HasWeapon("first_aid_kit") then ply:MedicNotif(sentences["You already carry a medical kit on you"][lang],5) return end
ply:Give("first_aid_kit")
ply:SelectWeapon("first_aid_kit")
local weap = ply:GetWeapon("first_aid_kit")
weap:SetBandage( self.Content["bandage"] )
weap:SetAntidote( self.Content["syringe_antidote"] )
weap:SetMorphine( self.Content["syringe_morphine"] )
self:Remove()
end
function ENT:Touch( ent )
self.nexttouch = self.nexttouch or 0
if self.nexttouch > CurTime() then return end
self.nexttouch = CurTime() + 0.5
if ent:GetClass() != "spawned_weapon" then return end
local content = ent:GetWeaponClass()
if not self.Content[content] then return end
self.Content[content] = self.Content[content] + 1
ent:Remove()
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "First Aid Kit"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true

View File

@@ -0,0 +1,8 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -0,0 +1,70 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/mural_defib/mural_defib.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
-- self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end
local sentences = ConfigurationMedicMod.Sentences
local lang = ConfigurationMedicMod.Language
function ENT:Think()
if not IsValid(self.User) then return end
if self.User:GetPos():DistToSqr( self:GetPos() ) > 62500 then
local ply = self.User
ply:GetActiveWeapon():Remove()
ply.CantSwitchWeapon = false
self.User = NULL
self.Used = false
constraint.RemoveConstraints( ply, "Rope" )
end
end
function ENT:Use( a, c )
if self.Used then
if c == self.User then
c:StripWeapon("defibrillator")
constraint.RemoveConstraints( c, "Rope" )
c.CantSwitchWeapon = false
self.User = NULL
self.Used = false
end
else
if c:HasWeapon("defibrillator") then c:MedicNotif(sentences["You already have a defibrillator on you"][lang]) return end
c:Give("defibrillator")
c:SelectWeapon("defibrillator")
constraint.Rope( self, c, 0, 0 , Vector(0,0,0), Vector(0,0,50), 50, 0, 0, 2, "cable/cable2", false )
c.CantSwitchWeapon = true
self.User = c
self.Used = true
end
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Mural defibrillator"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true

View File

@@ -0,0 +1,31 @@
include( "shared.lua" )
local sentences = ConfigurationMedicMod.Sentences
local lang = ConfigurationMedicMod.Language
function ENT:Draw()
self:DrawModel()
local dist = LocalPlayer():GetPos():Distance(self:GetPos())
if dist > 500 then return end
local ang = Angle(0, LocalPlayer():EyeAngles().y-90, 90)
local angle = self.Entity:GetAngles()
local position = self.Entity:GetPos()+Vector(0,0,0)
angle:RotateAroundAxis(angle:Forward(), 0);
angle:RotateAroundAxis(angle:Right(),0);
angle:RotateAroundAxis(angle:Up(), 90);
cam.Start3D2D(position+angle:Right()*0+angle:Up()*( math.sin(CurTime() * 2) * 2.5 + 78 )+angle:Forward()*0, ang, 0.1)
draw.RoundedBox( 5, -150/2, -25, 150, 50, Color(40,100,170, 500-dist ) )
draw.SimpleTextOutlined( sentences["Medic"][lang], "Trebuchet24" ,0,0, Color(255,255,255,500-dist), 1, 1, 1, Color(0,0,0))
cam.End3D2D()
end

View File

@@ -0,0 +1,38 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel( "models/Kleiner.mdl" )
self:SetHullType( HULL_HUMAN )
self:SetHullSizeNormal()
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX )
self:CapabilitiesAdd( CAP_ANIMATEDFACE || CAP_TURN_HEAD )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()
self.nextClick = CurTime() + 1
self:SetMaxYawSpeed( 90 )
end
function ENT:AcceptInput( event, a, p )
if( event == "Use" && p:IsPlayer() && self.nextClick < CurTime() ) then
self.nextClick = CurTime() + 2
if not p.Fractures then
p.Fractures = {}
end
net.Start("MedicMod.MedicMenu")
net.WriteEntity( self )
net.WriteTable( p.Fractures )
net.Send( p )
end
end

View File

@@ -0,0 +1,7 @@
ENT.Type = "ai"
ENT.Base = "base_ai"
ENT.AutomaticFrameAdvance = true
ENT.Author = "Venatuss"
ENT.Spawnable = true
ENT.Category = "Medic Mod"
ENT.PrintName = "Medic NPC"

View File

@@ -0,0 +1,101 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
local pos = self:GetPos() + Vector(0, 0, 80)
local ang = LocalPlayer():EyeAngles()
ang:RotateAroundAxis(ang:Forward(), 90)
ang:RotateAroundAxis(ang:Right(), 90)
if LocalPlayer():GetPos():DistToSqr(self:GetPos()) <= 60000 then
cam.Start3D2D(pos, ang, 0.05)
draw.SimpleTextOutlined("Торговец", "DermaLarge", 0, 0, Color(25, 175, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
draw.SimpleTextOutlined("Медикаменты", "DermaDefault", 0, 30, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
cam.End3D2D()
end
end
net.Receive("MedicTerminalNPC_Menu", function()
local npc = net.ReadEntity()
if not IsValid(npc) then return end
local frame = vgui.Create("DFrame")
frame:SetTitle("Аптека")
frame:SetSize(700, 500)
frame:Center()
frame:MakePopup()
frame.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, Color(30, 30, 30, 240))
draw.RoundedBox(0, 0, 0, w, 24, Color(20, 20, 20, 200))
end
local scroll = vgui.Create("DScrollPanel", frame)
scroll:Dock(FILL)
local layout = vgui.Create("DIconLayout", scroll)
layout:Dock(FILL)
layout:SetSpaceX(10)
layout:SetSpaceY(10)
local function AddItem(class, name, price, modelPath)
local pnl = layout:Add("DPanel")
pnl:SetSize(210, 160)
pnl.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, Color(45, 45, 45, 200))
draw.SimpleText(name, "DermaDefaultBold", w/2, 10, color_white, TEXT_ALIGN_CENTER)
if ix and ix.currency then
draw.SimpleText(ix.currency.Get(price), "DermaDefaultBold", w/2, 135, Color(100, 255, 100), TEXT_ALIGN_CENTER)
else
draw.SimpleText(price .. "$", "DermaDefaultBold", w/2, 135, Color(100, 255, 100), TEXT_ALIGN_CENTER)
end
end
local mdl = vgui.Create("DModelPanel", pnl)
mdl:SetSize(100, 100)
mdl:SetPos(55, 25)
mdl:SetModel(modelPath or "models/error.mdl")
if IsValid(mdl.Entity) then
local mn, mx = mdl.Entity:GetRenderBounds()
local size = 0
size = math.max(size, math.abs(mn.x) + math.abs(mx.x))
size = math.max(size, math.abs(mn.y) + math.abs(mx.y))
size = math.max(size, math.abs(mn.z) + math.abs(mx.z))
mdl:SetFOV(45)
mdl:SetCamPos(Vector(size, size, size))
mdl:SetLookAt((mn + mx) * 0.5)
end
local btn = vgui.Create("DButton", pnl)
btn:SetSize(210, 160)
btn:SetText("")
btn.Paint = function(self, w, h)
if self:IsHovered() then
draw.RoundedBox(4, 0, 0, w, h, Color(255, 255, 255, 15))
end
end
btn.DoClick = function()
net.Start("MedicTerminalNPC_Buy")
net.WriteEntity(npc)
net.WriteString(class)
net.SendToServer()
end
end
local items = npc:GetShopItems()
if items then
-- Сортировка по алфавиту имен
local sortedKeys = {}
for k, v in pairs(items) do table.insert(sortedKeys, k) end
table.sort(sortedKeys, function(a, b) return (items[a].name or "") < (items[b].name or "") end)
for _, class in ipairs(sortedKeys) do
local data = items[class]
AddItem(class, data.name, data.price, data.model)
end
end
end)

View File

@@ -0,0 +1,108 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
util.AddNetworkString("MedicTerminalNPC_Menu")
util.AddNetworkString("MedicTerminalNPC_Buy")
function ENT:Initialize()
self:SetModel("models/Humans/Group03m/Female_01.mdl")
self:PhysicsInit(SOLID_BBOX)
self:SetSolid(SOLID_BBOX)
self:SetMoveType(MOVETYPE_STEP)
self:SetCollisionBounds(Vector(-16, -16, 0), Vector(16, 16, 72))
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if IsValid(phys) then
phys:Wake()
phys:EnableMotion(false)
end
-- Анимация простоя (как у ix_shop_npc)
local sequence = self:LookupSequence("idle_subtle")
if sequence > 0 then
self:ResetSequence(sequence)
end
end
function ENT:Think()
self:NextThink(CurTime())
return true
end
function ENT:Use(activator, caller)
if not IsValid(activator) or not activator:IsPlayer() then return end
net.Start("MedicTerminalNPC_Menu")
net.WriteEntity(self)
net.Send(activator)
end
net.Receive("MedicTerminalNPC_Buy", function(len, ply)
local npc = net.ReadEntity()
local itemClass = net.ReadString()
if not IsValid(npc) or ply:GetPos():DistToSqr(npc:GetPos()) > 60000 then return end
if not ix then return end -- Using Helix
local char = ply:GetCharacter()
if not char then return end
local items = npc:GetShopItems()
local itemInfo = items[itemClass]
if not itemInfo then return end
local price = itemInfo.price
local name = itemInfo.name
local isWeapon = itemInfo.isWeapon
if price <= 0 then return end
if not char:HasMoney(price) then
ply:Notify("У вас недостаточно средств!")
return
end
if isWeapon then
if ply:HasWeapon(itemClass) then
ply:Notify("У вас уже есть " .. name .. "!")
return
end
char:TakeMoney(price)
ply:Give(itemClass)
-- Custom behavior for first aid kit as defined in MedicMod
timer.Simple(0.1, function()
if not IsValid(ply) then return end
local weap = ply:GetWeapon(itemClass)
if IsValid(weap) and itemClass == "first_aid_kit" then
if weap.SetBandage then weap:SetBandage(3) end
if weap.SetAntidote then weap:SetAntidote(1) end
if weap.SetMorphine then weap:SetMorphine(2) end
end
end)
ply:Notify("Вы купили " .. name .. " за " .. ix.currency.Get(price))
else
-- It's an entity
char:TakeMoney(price)
local ent = ents.Create(itemClass)
if IsValid(ent) then
local spawnPos = npc:GetPos() + npc:GetForward() * 50 + Vector(0, 0, 10)
ent:SetPos(spawnPos)
ent:SetAngles(npc:GetAngles())
ent:Spawn()
ent:Activate()
if CPPI then ent:CPPISetOwner(ply) end
ply:Notify("Вы купили " .. name .. " за " .. ix.currency.Get(price) .. ". Предмет появился рядом с продавцом.")
end
end
end)

View File

@@ -0,0 +1,69 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Торговец Медикаментами"
ENT.Author = "MedicMod"
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.Category = "Medic Mod"
ENT.AutomaticFrameAdvance = true
-- Кастомный ассортимент для этого NPC
ENT.ShopItems = {
-- Энтити:
["bloodbag_medicmod"] = { name = "Пакет крови", price = 500, model = "models/medicmod/bloodbag/bloodbag.mdl", isWeapon = false },
-- Оружие (SWEP):
["syringe_antidote"] = { name = "Шприц-Антидот", price = 50, model = "models/medicmod/syringe/w_syringe.mdl", isWeapon = true },
["analysis_notebook"] = { name = "Блокнот анализов", price = 100, model = "models/props_lab/clipboard.mdl", isWeapon = true },
["syringe_morphine"] = { name = "Шприц с морфием", price = 150, model = "models/medicmod/syringe/w_syringe.mdl", isWeapon = true },
}
function ENT:GetShopItems()
local items = {}
-- Список классов, которые мы не хотим показывать в магазине
local ignoreList = {
["drug_medicmod"] = true, -- Empty drug jar
["beaker_medicmod"] = true, -- Empty beaker
["drip_medicmod"] = true, -- drip
["defibrillator"] = true, -- defibrillator
["first_aid_kit"] = true, -- first aid kit (SWEP)
["firstaidkit_medicmod"] = true,-- first aid kit (ENT)
["bandage"] = true, -- повязка
["syringe_poison"] = true,
}
-- Добавляем из конфигов мода
if ConfigurationMedicMod then
if ConfigurationMedicMod.MedicShopEntities then
for k, v in pairs(ConfigurationMedicMod.MedicShopEntities) do
if not ignoreList[k] then
items[k] = { name = v.name, price = v.price, model = v.model, isWeapon = false }
end
end
end
if ConfigurationMedicMod.MedicShopWeapons then
for k, v in pairs(ConfigurationMedicMod.MedicShopWeapons) do
if not ignoreList[k] then
items[k] = { name = v.name, price = v.price, model = v.model, isWeapon = true }
end
end
end
if ConfigurationMedicMod.Entities then
for _, v in pairs(ConfigurationMedicMod.Entities) do
if not ignoreList[v.ent] then
items[v.ent] = { name = v.name, price = v.price, model = v.mdl, isWeapon = true }
end
end
end
end
-- Добавляем/перезаписываем кастомными предметами
if self.ShopItems then
for k, v in pairs(self.ShopItems) do
items[k] = v
end
end
return items
end

View File

@@ -0,0 +1,7 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -0,0 +1,95 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/radio/radio.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
-- self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
local screen = ents.Create("computer_screen_medicmod")
screen:SetPos( self:GetPos() + self:GetAngles():Forward() * -35 + self:GetAngles():Up() * 70 )
local ang = self:GetAngles()
ang:RotateAroundAxis(ang:Forward(), 0);
ang:RotateAroundAxis(ang:Right(),0);
ang:RotateAroundAxis(ang:Up(), 180);
screen:SetAngles( ang )
screen:Spawn()
screen:SetParent( self )
self.Screen = screen
end
local sentences = ConfigurationMedicMod.Sentences
local lang = ConfigurationMedicMod.Language
function ENT:ScanPlayer( ply )
local pos = ply:GetPos()
local ang = ply:GetAngles()
local hbed = ents.Create("prop_vehicle_prisoner_pod")
hbed:SetModel("models/vehicles/prisoner_pod_inner.mdl")
hbed:SetPos( self:GetPos() + self:GetAngles():Up() * 40 + self:GetAngles():Right() * -35+ self:GetAngles():Forward() * 20 )
hbed:SetAngles( self:GetAngles() + Angle(-90,0,90))
hbed:SetNoDraw(true)
hbed:SetCollisionGroup(COLLISION_GROUP_WORLD)
hbed:SetSolid(SOLID_NONE)
hbed.locked = true
self.ragdoll = hbed
ply:EnterVehicle(hbed)
ply:MedicNotif( sentences["You are being scanned"][lang], ConfigurationMedicMod.ScanRadioTime)
ply:Freeze( true )
timer.Simple( ConfigurationMedicMod.ScanRadioTime, function()
if not IsValid(ply) or not IsValid(self) or not IsValid(hbed) then return end
ply:Freeze( false )
ply:ExitVehicle(hbed)
hbed:Remove()
ply:SetPos( pos )
ply:SetEyeAngles( ang )
self.ragdoll = nil
if not ply.Fractures then return end
net.Start("MedicMod.ScanRadio")
net.WriteEntity( self )
net.WriteTable( ply.Fractures )
net.Broadcast()
end)
end
function ENT:Use( a, c )
if self.ragdoll then return end
self:ScanPlayer( c )
end
function ENT:OnRemove()
if IsValid( self.ragdoll ) then
self.ragdoll:Remove()
end
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Radio"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true

View File

@@ -0,0 +1,8 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end

View File

@@ -0,0 +1,130 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/stretcher/stretcher.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:StartMotionController()
self.ShadowParams = {}
self:SetPos(self:GetPos() + Vector(0,0,50))
end
function ENT:PhysicsSimulate( phys, deltatime )
phys:Wake()
self.ShadowParams.secondstoarrive = 0.1
self.ShadowParams.angle = Angle( 0, self:GetAngles().yaw, 0 )
self.ShadowParams.maxangular = 5000
self.ShadowParams.maxangulardamp = 10000
phys:ComputeShadowControl( self.ShadowParams )
end
local boneAngles = {
[1] = {
bone = "ValveBiped.Bip01_R_Foot",
ang = Angle(0,0,0)
},
[2] = {
bone = "ValveBiped.Bip01_L_Foot",
ang = Angle(-0,0,0)
},
[3] = {
bone = "ValveBiped.Bip01_R_ForeArm",
ang = Angle(-20,0,0)
},
[4] = {
bone = "ValveBiped.Bip01_L_ForeArm",
ang = Angle(20,0,0)
},
[5] = {
bone = "ValveBiped.Bip01_L_UpperArm",
ang = Angle(20,-0,0)
},
[6] = {
bone = "ValveBiped.Bip01_R_UpperArm",
ang = Angle(-20,-0,0)
},
[7] = {
bone = "ValveBiped.Bip01_Head1",
ang = Angle(20,0,45)
},
}
function ENT:CreateDeathRagdoll( ply )
local ragdoll = ents.Create("prop_physics")
ragdoll:SetPos(self:GetPos()+self:GetAngles():Up() * 12+self:GetAngles():Right()*35)
ragdoll:SetAngles(Angle(-90,self:GetAngles().Yaw,-90))
ragdoll:SetModel(ply:GetModel())
ragdoll:Spawn()
ragdoll:SetParent(self)
for _, inf in pairs( boneAngles ) do
local bone = ragdoll:LookupBone(inf.bone)
if bone then
ragdoll:ManipulateBoneAngles(bone, inf.ang)
end
end
ragdoll:SetOwner( ply )
ragdoll:SetDeathRagdoll( true )
-- Set the view on the ragdoll
ply:Spectate( OBS_MODE_CHASE )
ply:SpectateEntity( ragdoll )
return ragdoll
end
function ENT:Touch( ent )
if ent:GetClass() == "bed_medicmod" then return end
local rag
if ent:IsDeathRagdoll() then
rag = ent
elseif IsValid(ent.ragdoll) && ent.ragdoll:IsDeathRagdoll() then
rag = ent.ragdoll
elseif ent:IsVehicle() && ConfigurationMedicMod.Vehicles[ent:GetModel()] && not IsValid(ent.Stretcher) then
if self:GetPos():Distance(ent:LocalToWorld(ConfigurationMedicMod.Vehicles[ent:GetModel()].backPos)) > 150 then return end
self:SetPos(ent:LocalToWorld(ConfigurationMedicMod.Vehicles[ent:GetModel()].stretcherPos))
self:SetAngles(ent:LocalToWorldAngles(ConfigurationMedicMod.Vehicles[ent:GetModel()].stretcherAngle))
self:SetParent( ent )
ent.Stretcher = self
ent.SpawnedStretcher = self
if not ConfigurationMedicMod.Vehicles[ent:GetModel()].drawStretcher then
self:SetRenderMode( RENDERMODE_TRANSALPHA )
self:SetColor( Color(0,0,0,0) )
end
return
end
if self.ragdoll && IsValid( self.ragdoll ) then return end
if not IsValid( rag ) then return end
if not IsValid( rag:GetOwner() ) then return end
local ply = rag:GetOwner()
self.ragdoll = self:CreateDeathRagdoll( ply )
ply.DeathRagdoll = self.ragdoll
rag:Remove()
end

View File

@@ -0,0 +1,6 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Stretcher"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = true

View File

@@ -0,0 +1,29 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
if not self:GetProduct() then return end
if not ConfigurationMedicMod.Reagents[self:GetProduct()] then return end
local dist = LocalPlayer():GetPos():Distance(self:GetPos())
if dist > 500 then return end
local angle = self.Entity:GetAngles()
local position = self.Entity:GetPos() + angle:Forward() * -2
angle:RotateAroundAxis(angle:Forward(), 90);
angle:RotateAroundAxis(angle:Right(),90);
angle:RotateAroundAxis(angle:Up(), 0);
cam.Start3D2D(position, angle, 0.2)
draw.SimpleTextOutlined(self:GetProduct(), "MedicModFont15" ,0,-60, Color(255,255,255,255), 1, 1, 0.5, Color(0,0,0,255))
draw.RoundedBox( 3, -3,-30, 5, 25, ConfigurationMedicMod.Reagents[self:GetProduct()].color )
cam.End3D2D()
end

View File

@@ -0,0 +1,27 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/medicmod/test_tube/testtube.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DropToFloor()
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
end
function ENT:OnRemove()
if self.TestTubeSpawner and IsValid( self.TestTubeSpawner ) then
local testtubesspawned = self.TestTubeSpawner.TestTubesSpawned or 1
self.TestTubeSpawner.TestTubesSpawned = testtubesspawned - 1 or 0
end
end

View File

@@ -0,0 +1,10 @@
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Test tube"
ENT.Category = "Medic Mod"
ENT.Author = "Venatuss"
ENT.Spawnable = false
function ENT:SetupDataTables()
self:NetworkVar("String", 0, "Product")
end