Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

beta branch

  • Loading branch information...
commit 73d5ffecee08ec2c4b1d5e43fa2ef009817ed57a 1 parent ffa29ad
Falco Peijnenburg authored
Showing with 1,939 additions and 2,251 deletions.
  1. +6 −7 info.txt → DarkRP.txt
  2. +13 −7 changelog.txt
  3. BIN  content/materials/DarkRP/DarkRPSkin.png
  4. +1 −1  entities/entities/bdr_button/cl_init.lua
  5. +3 −3 entities/entities/chatindicator/init.lua
  6. +3 −3 entities/entities/ctrl_racegame/init.lua
  7. +1 −1  entities/entities/ctrl_racemanager/init.lua
  8. +2 −2 entities/entities/darkrp_cheque/cl_init.lua
  9. +5 −5 entities/entities/darkrp_cheque/init.lua
  10. +3 −3 entities/entities/darkrp_console/cl_init.lua
  11. +1 −1  entities/entities/darkrp_console/init.lua
  12. +1 −1  entities/entities/darkrp_laws/init.lua
  13. +1 −1  entities/entities/drug/cl_init.lua
  14. +5 −5 entities/entities/drug/init.lua
  15. +1 −1  entities/entities/drug_lab/cl_init.lua
  16. +6 −6 entities/entities/ent_checkpoint/cl_init.lua
  17. +4 −4 entities/entities/ent_checkpoint/init.lua
  18. +1 −1  entities/entities/ent_start/cl_init.lua
  19. +4 −4 entities/entities/ent_surfprop/init.lua
  20. +2 −2 entities/entities/fadmin_jail/init.lua
  21. +3 −3 entities/entities/fadmin_motd/cl_init.lua
  22. +1 −1  entities/entities/fadmin_motd/init.lua
  23. +1 −1  entities/entities/gunlab/cl_init.lua
  24. +14 −12 entities/entities/gunlab/init.lua
  25. +2 −2 entities/entities/letter/cl_init.lua
  26. +1 −1  entities/entities/letter/init.lua
  27. +1 −1  entities/entities/microwave/cl_init.lua
  28. +2 −2 entities/entities/microwave/init.lua
  29. +1 −1  entities/entities/money_printer/cl_init.lua
  30. +6 −6 entities/entities/money_printer/init.lua
  31. +0 −19 entities/entities/phone/cl_init.lua
  32. +0 −134 entities/entities/phone/init.lua
  33. +0 −26 entities/entities/phone/shared.lua
  34. +12 −5 entities/entities/spawned_shipment/cl_init.lua
  35. +4 −4 entities/entities/spawned_shipment/init.lua
  36. +9 −9 entities/weapons/arrest_stick/shared.lua
  37. +1 −1  entities/weapons/door_ram/shared.lua
  38. +9 −9 entities/weapons/gmod_tool/stools/checkpoint_setter.lua
  39. +8 −8 entities/weapons/gmod_tool/stools/shareprops.lua
  40. +10 −9 entities/weapons/keys/shared.lua
  41. +22 −22 entities/weapons/lockpick/shared.lua
  42. +3 −3 entities/weapons/ls_snip_base/shared.lua
  43. +30 −20 entities/weapons/med_kit/shared.lua
  44. +13 −14 entities/weapons/pocket/shared.lua
  45. +11 −11 entities/weapons/stunstick/shared.lua
  46. +8 −8 entities/weapons/unarrest_stick/shared.lua
  47. +19 −9 entities/weapons/weapon_cs_base2/shared.lua
  48. +15 −4 entities/weapons/weapon_keypadchecker/cl_init.lua
  49. +4 −2 entities/weapons/weapon_keypadchecker/shared.lua
  50. +7 −7 entities/weapons/weapon_pumpshotgun2/shared.lua
  51. +24 −27 entities/weapons/weaponchecker/shared.lua
  52. +1 −1  gamemode/FAdmin/Access/cl_init.lua
  53. +6 −6 gamemode/FAdmin/Access/sh_shared.lua
  54. +5 −5 gamemode/FAdmin/Access/sv_init.lua
  55. +6 −6 gamemode/FAdmin/CL_Interface/cl_PlayerLists.lua
  56. +22 −10 gamemode/FAdmin/CL_Interface/cl_controls.lua
  57. +7 −9 gamemode/FAdmin/CL_Interface/cl_scoreboard.lua
  58. +14 −13 gamemode/FAdmin/CL_Interface/cl_scoreboardMain.lua
  59. +44 −59 gamemode/FAdmin/CL_Interface/cl_scoreboardPlayer.lua
  60. +33 −45 gamemode/FAdmin/CL_Interface/cl_scoreboardServer.lua
  61. +76 −2 gamemode/FAdmin/CL_Interface/cl_start.lua
  62. +15 −19 gamemode/FAdmin/Changelevel/cl_changelevelGUI.lua
  63. +4 −5 gamemode/FAdmin/Changelevel/cl_init.lua
  64. +6 −6 gamemode/FAdmin/Changelevel/cl_maplistoptions.lua
  65. +6 −6 gamemode/FAdmin/Logging/sv_init.lua
  66. +25 −25 gamemode/FAdmin/Messaging/cl_init.lua
  67. +3 −3 gamemode/FAdmin/Messaging/sh_shared.lua
  68. +14 −14 gamemode/FAdmin/Motd/sv_init.lua
  69. +2 −2 gamemode/FAdmin/PickUpPlayers/sv_init.lua
  70. +5 −5 gamemode/FAdmin/PlayerActions/Message/sv_init.lua
  71. +13 −13 gamemode/FAdmin/PlayerActions/Noclip/sv_init.lua
  72. +4 −4 gamemode/FAdmin/PlayerActions/changeteam/sv_init.lua
  73. +9 −9 gamemode/FAdmin/PlayerActions/chatmute/sv_init.lua
  74. +18 −18 gamemode/FAdmin/PlayerActions/cloak/sv_init.lua
  75. +11 −11 gamemode/FAdmin/PlayerActions/freeze/sv_init.lua
  76. +24 −25 gamemode/FAdmin/PlayerActions/giveweapons/cl_controls.lua
  77. +12 −12 gamemode/FAdmin/PlayerActions/giveweapons/sv_init.lua
  78. +11 −11 gamemode/FAdmin/PlayerActions/god/sv_init.lua
  79. +9 −16 gamemode/FAdmin/PlayerActions/health/cl_init.lua
  80. +5 −5 gamemode/FAdmin/PlayerActions/health/sv_init.lua
  81. +13 −13 gamemode/FAdmin/PlayerActions/ignite/sv_init.lua
  82. +26 −26 gamemode/FAdmin/PlayerActions/jail/sv_init.lua
  83. +7 −5 gamemode/FAdmin/PlayerActions/kickban/cl_init.lua
  84. +10 −10 gamemode/FAdmin/PlayerActions/kickban/sv_init.lua
  85. +25 −25 gamemode/FAdmin/PlayerActions/ragdoll/sv_init.lua
  86. +12 −12 gamemode/FAdmin/PlayerActions/slap/sv_init.lua
  87. +5 −5 gamemode/FAdmin/PlayerActions/slay/sv_init.lua
  88. +2 −2 gamemode/FAdmin/PlayerActions/spectate/cl_init.lua
  89. +2 −2 gamemode/FAdmin/PlayerActions/spectate/sv_init.lua
  90. +5 −5 gamemode/FAdmin/PlayerActions/strip_weapons/sv_init.lua
  91. +31 −31 gamemode/FAdmin/PlayerActions/teleport/sv_init.lua
  92. +13 −13 gamemode/FAdmin/PlayerActions/voicemute/sv_init.lua
  93. +8 −15 gamemode/FAdmin/ServerSettings/cl_init.lua
  94. +1 −1  gamemode/FAdmin/commands/sv_chatcommands.lua
  95. +6 −6 gamemode/FAdmin/commands/sv_concommands.lua
  96. +19 −28 gamemode/FPP/client/FPP_HUD.lua
  97. +104 −145 gamemode/FPP/client/FPP_Menu.lua
  98. +8 −8 gamemode/FPP/server/FPP_Antispam.lua
  99. +17 −14 gamemode/FPP/server/FPP_Settings.lua
  100. +51 −33 gamemode/FPP/server/FPP_core.lua
  101. +3 −4 gamemode/FPP/sh_CPPI.lua
  102. +75 −53 gamemode/cl_init.lua
  103. +239 −78 gamemode/client/DRPDermaSkin.lua
  104. +0 −1  gamemode/client/help.lua
  105. +5 −5 gamemode/client/helpvgui.lua
  106. +28 −28 gamemode/client/hud.lua
  107. +94 −193 gamemode/client/showteamtabs.lua
  108. +14 −190 gamemode/client/vgui.lua
  109. +35 −30 gamemode/init.lua
  110. +4 −5 gamemode/modules/{AFK.lua → AFK/sv_AFK.lua}
  111. +6 −1 gamemode/modules/HungerMod/cl_init.lua
  112. +21 −23 gamemode/modules/{HungerMod.lua → HungerMod/sv_HungerMod.lua}
  113. +2 −2 gamemode/modules/HungerMod/{player.lua → sv_player.lua}
  114. +2 −2 gamemode/modules/events.lua
  115. +1 −1  gamemode/modules/properties.lua
  116. +0 −35 gamemode/modules/proplympics.lua
  117. +16 −0 gamemode/modules/proplympics/sv_proplympics.lua
  118. +6 −11 gamemode/modules/{sleep.lua → sleep/sv_sleep.lua}
  119. +38 −38 gamemode/server/admincc.lua
  120. +2 −2 gamemode/server/chat.lua
  121. +13 −10 gamemode/server/data.lua
  122. +52 −57 gamemode/server/gamemode_functions.lua
  123. +51 −109 gamemode/server/main.lua
  124. +26 −41 gamemode/server/player.lua
  125. +1 −1  gamemode/server/questions.lua
  126. +22 −1 gamemode/server/util.lua
  127. +2 −2 gamemode/server/votes.lua
  128. +24 −18 gamemode/shared/FAdmin_DarkRP.lua
  129. +1 −1  gamemode/shared/MakeThings.lua
  130. +20 −51 gamemode/shared/Workarounds.lua
  131. +29 −27 gamemode/shared/animations.lua
  132. +2 −2 gamemode/shared/commands.lua
  133. +26 −26 gamemode/shared/entity.lua
  134. BIN  icon24.png
  135. BIN  logo.png
13 info.txt → DarkRP.txt
View
@@ -1,18 +1,17 @@
"Gamemode"
{
- "name" "DarkRP"
- "version" "2.4.2"
+ "base" "sandbox"
+ "title" "DarkRP"
+ "version" "2.4.3"
+ "menusystem" "1"
"author_name" "LightRP: Rick darkalonio, DarkRP: Rickster, Pcwizdan, Sibre, philxyz, [GNC] Matt, Chrome Bolt, FPtje Falco, Eusion, Drakehawke"
"author_email" ""
"author_url" "http://darkrp.googlecode.com"
+ "maps" "^rp_"
+
"icon" ""
"info" ""
"hide" "0"
-
- "mappattern"
- {
- "1" "^rp_"
- }
}
20 changelog.txt
View
@@ -1,4 +1,8 @@
-DarkRP 2.4.2 SVN
+This list is missing content. For a full list see:
+http://code.google.com/p/darkrp/source/list
+for the latest changes
+
+DarkRP 2.4.3
[ADD] Laws system! Use /placelaws to spawn a screen displaying the laws, /addlaw and /removelaw to edit them. rp_maxlawboards to set the limit.
[ADD] AFK NPC
[ADD] Signing of letters
@@ -7,6 +11,8 @@ DarkRP 2.4.2 SVN
[CHANGE] Updated Notifies to work better with the newer ones
[CHANGE] Lots of function/network optimisation
[CHANGE] Remade HUD
+...
+
DarkRP 2.4.2
[CHANGE Drakehawke] Fixed the default GMod admin cleanup from unowning/resetting doors.
@@ -265,7 +271,7 @@ DarkRP 2.3.5:
Updated by: FPtje Falco
[ADD] Cops can arrest sleeping people
-[ADD] Admins can disable the No-respawning when changing job with rp_norespawn
+[ADD] Admins can disable the No-respawning when changing job with rp_norespawn
[ADD] Admins can allow/disallow hobo's by doing rp_allowhobos <1/0>
[ADD] Every door and vehicle controls are put in the reload function of the keys SWEP
[ADD] Re-added the earthquake sound
@@ -286,7 +292,7 @@ Updated by: FPtje Falco
[ADD] /advert command: Say /advert <advertisement> to advert!
[ADD] Rp_BabyGod: Players are immortal when they've just spawned.
[ADD] Rp_<job> for every job, not only cp, mayor and cpchief
-[ADD] Color codes when rp_alltalk = 0: People can see who can hear them whisper/talk normally/yell and who cannot hear them.
+[ADD] Color codes when rp_alltalk = 0: People can see who can hear them whisper/talk normally/yell and who cannot hear them.
[ADD] Expanded /buyfood, Now you can do more than /buyfood melon. It's also in the F4 menu!
[CHANGE] All door controls are now done though reload with the Keys weapon.
[CHANGE] Descriptions in the change job VGUI(thanks james hutchins)
@@ -326,7 +332,7 @@ Updated by: FPtje Falco
[FIX] Prices etc. resetting to 0
[FIX] HUGE FUCKING MAJOR EXPLOIT where you enter a console command after doing /votecop or /votemayor and just become a cop without anyone voting yes.
[FIX] The ability of people to somehow get <nothing> as RP name(Always happened with bots too)
-[FIX] People being able to get less than 0 money. DarkRP just doesn't work with depts
+[FIX] People being able to get less than 0 money. DarkRP just doesn't work with depts
[FIX] rp_grant and rp_revoke not working properly, Philxyz fucked the caching system up(Phil look at my code to fix it for your release :D)
[FIX] Demote: the demoter can't vote anymore now.
[FIX] Unable to select keys when you got a different weapon(like the 357)
@@ -781,7 +787,7 @@ Updated by: Zorblet
[Add] rp_doorcost <amount> - The Cost to buy a door.
[Add] rp_zombiescore <amount> - The money awarded for a NPC Kill.
[Add] Player's now spawn with Cameras
-[Add] Grenades to BuyShipment
+[Add] Grenades to BuyShipment
[Add] Flashbangs to Buyshipment
[Add] /sleep for 10 seconds then /sleep again to unsleep
[Add] CfgVar "physgun"
@@ -820,7 +826,7 @@ Updated by: Pcwizdan
[Add] rp_doorcost <amount> - The Cost to buy a door.
[Add] rp_zombiescore <amount> - The money awarded for a NPC Kill.
1[Add] Player's now spawn with Cameras
-1[Add] Grenades to BuyShipment
+1[Add] Grenades to BuyShipment
1[Add] Flashbangs to Buyshipment
1[Add] /sleep for 10 seconds then /sleep again to unsleep
[Add] flash/gren so only 2 spawns...
@@ -876,7 +882,7 @@ February 1, 2007
[Fix] Console can now do rp admin commands
[Fix] Help menu reorganized
[Fix] Changing chat prefix would glitch up the help menu
-[Fix] You can lock/unlock owned vehicles
+[Fix] You can lock/unlock owned vehicles
[Fix] You can vote anytime you're in gui "clicker" mode.
[Fix] /give and /drop money can't do negative money
BIN  content/materials/DarkRP/DarkRPSkin.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2  entities/entities/bdr_button/cl_init.lua
View
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Draw()
- if self.dt.owner ~= LocalPlayer() or Color(self:GetColor()).a == 0 then return end
+ if self.dt.owner ~= LocalPlayer() or self:GetColor().a == 0 then return end
surface.SetFont("HUDNumber5")
local w,h = surface.GetTextSize(self:GetNWString("text"))
6 entities/entities/chatindicator/init.lua
View
@@ -13,7 +13,7 @@ function ENT:Initialize()
end
function ENT:Think()
- if not ValidEntity( self.ply ) then -- just in case
+ if not IsValid( self.ply ) then -- just in case
self:Remove()
@@ -26,7 +26,7 @@ end
local function ToggleChatIndicator( ply )
- if not ValidEntity( ply.ChatIndicator ) then
+ if not IsValid( ply.ChatIndicator ) then
ply.ChatIndicator = ents.Create( "chatindicator" )
ply.ChatIndicator.ply = ply -- plyception
@@ -45,7 +45,7 @@ concommand.Add( "_DarkRP_ToggleChat", ToggleChatIndicator )
local function RemoveChatIndicator( ply )
- if ValidEntity( ply.ChatIndicator ) then
+ if IsValid( ply.ChatIndicator ) then
ply.ChatIndicator:Remove()
6 entities/entities/ctrl_racegame/init.lua
View
@@ -84,7 +84,7 @@ function ENT:CountDown()
if count == 0 then
timer.Simple(300, function()
- if ValidEntity(self) then
+ if IsValid(self) then
self:CalculateWinner()-- Some people will never make it to the finish... :)
end
end)
@@ -95,7 +95,7 @@ end
function ENT:Finish(ply)
for k,v in pairs(self.surfProps) do
- if not ValidEntity(v.Owner) then
+ if not IsValid(v.Owner) then
SafeRemoveEntity(v)
table.remove(self.surfProps)
end
@@ -111,7 +111,7 @@ function ENT:Finish(ply)
end
function ENT:CalculateWinner()
- if ValidEntity(self.Finishers[1]) then
+ if IsValid(self.Finishers[1]) then
for k,v in pairs(self.manager:getParticipants()) do
v:ChatPrint("The race has finished! ".. self.Finishers[1]:Nick() .." has won! Congratulations!")
end
2  entities/entities/ctrl_racemanager/init.lua
View
@@ -20,7 +20,7 @@ function ENT:Initialize()
self.participants = {}
self.CheckPoints = {}
- if not ValidEntity(self.Player) then self:Remove() end
+ if not IsValid(self.Player) then self:Remove() end
--self.Player:SendLua("Entity(".. self:EntIndex().."):Start()")
self.PlayerHasTool = self.Player:HasWeapon("gmod_tool")
self.Player:Give("gmod_tool")
4 entities/entities/darkrp_cheque/cl_init.lua
View
@@ -2,13 +2,13 @@ include("shared.lua")
function ENT:Draw()
self:DrawModel()
- if not ValidEntity(self.dt.owning_ent) or not ValidEntity(self.dt.recipient) then return end
+ if not IsValid(self.dt.owning_ent) or not IsValid(self.dt.recipient) then return end
local Pos = self:GetPos()
local Ang = self:GetAngles()
local amount = tostring(self.dt.amount) or "0"
- local owner = (ValidEntity(self.dt.owning_ent) and self.dt.owning_ent.Name and self.dt.owning_ent:Name()) or "N/A"
+ local owner = (IsValid(self.dt.owning_ent) and self.dt.owning_ent.Name and self.dt.owning_ent:Name()) or "N/A"
local recipient = (self.dt.recipient.Name and self.dt.recipient:Name()) or "N/A"
surface.SetFont("ChatFont")
10 entities/entities/darkrp_cheque/init.lua
View
@@ -24,17 +24,17 @@ function ENT:Use(activator, caller)
local recipient = self.dt.recipient
local amount = self.dt.amount or 0
- if (ValidEntity(activator) and ValidEntity(recipient)) and activator == recipient then
- owner = (ValidEntity(owner) and owner:Nick()) or "Disconnected player"
+ if (IsValid(activator) and IsValid(recipient)) and activator == recipient then
+ owner = (IsValid(owner) and owner:Nick()) or "Disconnected player"
GAMEMODE:Notify(activator, 0, 4, "You have found " .. CUR .. amount .. " in a cheque made out to you from " .. owner .. ".")
activator:AddMoney(amount)
self:Remove()
- elseif (ValidEntity(owner) and ValidEntity(recipient)) and owner ~= activator then
+ elseif (IsValid(owner) and IsValid(recipient)) and owner ~= activator then
GAMEMODE:Notify(activator, 0, 4, "This cheque is made out to " .. recipient:Name() .. ".")
- elseif ValidEntity(owner) and owner == activator then
+ elseif IsValid(owner) and owner == activator then
GAMEMODE:Notify(activator, 0, 4, "You have torn up the cheque.")
owner:AddMoney(self.dt.amount) -- return the money on the cheque to the owner.
self:Remove()
- elseif not ValidEntity(recipient) then self:Remove()
+ elseif not IsValid(recipient) then self:Remove()
end
end
6 entities/entities/darkrp_console/cl_init.lua
View
@@ -6,7 +6,7 @@ end
function ENT:Draw()
self:DrawModel()
- if ValidEntity(self.dt.reporter) and self.dt.reporter.Name and ValidEntity(self.dt.reported) and self.dt.reported.Name and self:GetNWString("reason") != nil then
+ if IsValid(self.dt.reporter) and self.dt.reporter.Name and IsValid(self.dt.reported) and self.dt.reported.Name and self:GetNWString("reason") != nil then
local reporter = self.dt.reporter:Name()
local reported = self.dt.reported:Name()
local reason = self:GetNWString("reason")
@@ -49,7 +49,7 @@ local function Memory(um)
local Reporter, Reported = ent.dt and ent.dt.reporter, ent.dt and ent.dt.reported
hook.Add("HUDPaint", "darkRP_memory", function()
- if ValidEntity(Reporter) and ValidEntity(Reported) then
+ if IsValid(Reporter) and IsValid(Reported) then
local VicPos = ((Reporter.GetShootPos and Reporter:GetShootPos()) or Reporter:GetPos()) + Vector(0,0,10)
local VillainPos = ((Reported.GetShootPos and Reported:GetShootPos()) or Reported:GetPos()) + Vector(0,0,10)
@@ -65,7 +65,7 @@ local function Memory(um)
end
end)
- timer.Simple(MemoryTime, hook.Remove, "HUDPaint", "darkRP_memory")
+ timer.Simple(MemoryTime, function() hook.Remove("HUDPaint", "darkRP_memory") end)
end
usermessage.Hook("darkrp_memory", Memory)
2  entities/entities/darkrp_console/init.lua
View
@@ -23,7 +23,7 @@ function ENT:OnTakeDamage(dmg)
end
function ENT:Use(activator, caller)
- if activator:IsCP() and ValidEntity(self.dt.reporter) then
+ if activator:IsCP() and IsValid(self.dt.reporter) then
local memory = math.random(60, 125)
umsg.Start("darkrp_memory", activator)
umsg.Entity(self)
2  entities/entities/darkrp_laws/init.lua
View
@@ -134,7 +134,7 @@ local function PlaceLaws( ply, args )
ent:Spawn()
ent:Activate()
- if ValidEntity( ent ) then
+ if IsValid( ent ) then
numlaws = numlaws + 1
2  entities/entities/drug/cl_init.lua
View
@@ -10,7 +10,7 @@ function ENT:Draw()
local Ang = self:GetAngles()
local owner = self.dt.owning_ent
- owner = (ValidEntity(owner) and owner:Nick()) or "Unknown"
+ owner = (IsValid(owner) and owner:Nick()) or "Unknown"
surface.SetFont("HUDNumber5")
local TextWidth = surface.GetTextSize("Drugs!")
10 entities/entities/drug/init.lua
View
@@ -3,7 +3,7 @@ AddCSLuaFile("shared.lua")
include("shared.lua")
local function DrugPlayer(ply)
- if not ValidEntity(ply) then return end
+ if not IsValid(ply) then return end
local RP = RecipientFilter()
RP:RemoveAllPlayers()
RP:AddPlayer(ply)
@@ -21,15 +21,15 @@ local function DrugPlayer(ply)
if not timer.IsTimer(IDSteam.."DruggedHealth") and not timer.IsTimer(IDSteam) then
ply:SetHealth(ply:Health() + 100)
timer.Create(IDSteam.."DruggedHealth", 60/(100 + 5), 100 + 5, function()
- if ValidEntity(ply) then ply:SetHealth(ply:Health() - 1) end
+ if IsValid(ply) then ply:SetHealth(ply:Health() - 1) end
if ply:Health() <= 0 then ply:Kill() end
end)
- timer.Create(IDSteam, 60, 1, UnDrugPlayer, ply)
+ timer.Create(IDSteam, 60, 1, function() UnDrugPlayer(ply) end)
end
end
function UnDrugPlayer(ply) -- Global function, used in sv_gamemode_functions
- if not ValidEntity(ply) then return end
+ if not IsValid(ply) then return end
local RP = RecipientFilter()
RP:RemoveAllPlayers()
RP:AddPlayer(ply)
@@ -92,6 +92,6 @@ end
function ENT:OnRemove()
local ply = self.dt.owning_ent
- if not ValidEntity(ply) then return end
+ if not IsValid(ply) then return end
ply.maxDrugs = ply.maxDrugs - 1
end
2  entities/entities/drug_lab/cl_init.lua
View
@@ -7,7 +7,7 @@ function ENT:Draw()
local Ang = self:GetAngles()
local owner = self.dt.owning_ent
- owner = (ValidEntity(owner) and owner:Nick()) or "Unknown"
+ owner = (IsValid(owner) and owner:Nick()) or "Unknown"
surface.SetFont("HUDNumber5")
local TextWidth = surface.GetTextSize("Druglab!")
12 entities/entities/ent_checkpoint/cl_init.lua
View
@@ -47,13 +47,13 @@ function ENT:Draw()
render.SuppressEngineLighting(true)
render.SetBlend(0.3)
render.SetColorModulation(1, self.Passed and 0 or 1, 0)
- if ValidEntity(self.Visual) then
+ if IsValid(self.Visual) then
self.Visual:DrawModel()
end
- if ValidEntity(self.Arrow) then
+ if IsValid(self.Arrow) then
- render.SetBlend(Color(self.Arrow:GetColor()).a/255)
+ render.SetBlend(self.Arrow:GetColor().a/255)
render.SetColorModulation(0,0,255)
self.Arrow:DrawModel()
end
@@ -66,7 +66,7 @@ function ENT:setPassed(bool)
end
function ENT:Think()
- if ValidEntity(LocalPlayer():GetNWEntity("SurfProp")) and LocalPlayer():GetNWEntity("SurfProp").dt.lastCheckpoint == self then
+ if IsValid(LocalPlayer():GetNWEntity("SurfProp")) and LocalPlayer():GetNWEntity("SurfProp").dt.lastCheckpoint == self then
self:setPassed(true)
end
@@ -76,10 +76,10 @@ function ENT:Think()
self.Visual:SetModelScale(Vector(size, size, size))
end
- if not ValidEntity(self.dt.nextCheckpoint) and ValidEntity(self.Arrow) then
+ if not IsValid(self.dt.nextCheckpoint) and IsValid(self.Arrow) then
self.Arrow:SetNoDraw(true)
self.Arrow:SetColor(0,0,255,0)
- elseif ValidEntity(self.Arrow) then
+ elseif IsValid(self.Arrow) then
--self.Arrow:SetNoDraw(false)
self.Arrow:SetColor(0,0,255,255)
local ang = (self.dt.nextCheckpoint:GetPos() - self:GetPos()):Angle()
8 entities/entities/ent_checkpoint/init.lua
View
@@ -1,6 +1,6 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
-
+
include('shared.lua')
--[[
@@ -41,10 +41,10 @@ function ENT:setHasPassed(ply, bool) -- This function is going to be overridden
end
function ENT:Think()
- if not ValidEntity(self.dt.manager) or not self.dt.manager:getParticipants() or self.dt.manager.dt.stage ~= 3 then return end
+ if not IsValid(self.dt.manager) or not self.dt.manager:getParticipants() or self.dt.manager.dt.stage ~= 3 then return end
for _, ply in pairs(self.dt.manager:getParticipants()) do
- if not ValidEntity(ply) then
+ if not IsValid(ply) then
for k,v in pairs(self.dt.manager.Participants) do
if v == ply then
self.dt.manager.Participants[k] = nil
@@ -53,7 +53,7 @@ function ENT:Think()
continue
end
if ply:GetPos():Distance(self:GetPos()) < self.dt.radius then
- if ValidEntity(self.dt.previousCheckpoint) and not self.dt.previousCheckpoint:getHasPassed(ply) then
+ if IsValid(self.dt.previousCheckpoint) and not self.dt.previousCheckpoint:getHasPassed(ply) then
-- You haven't passed the previous one yet!
return
end
2  entities/entities/ent_start/cl_init.lua
View
@@ -27,7 +27,7 @@ function ENT:setPassed(bool)
end
function ENT:Draw()
- if not ValidEntity(self.dt.manager) or self.dt.manager.dt.stage ~= 2 then return end
+ if not IsValid(self.dt.manager) or self.dt.manager.dt.stage ~= 2 then return end
local color = Color(self.dt.manager.participating and 0 or 255,self.dt.manager.participating and 255 or 0,0,80)
local ang = self:GetAngles()
8 entities/entities/ent_surfprop/init.lua
View
@@ -42,7 +42,7 @@ function ENT:SpawnPlayer(pos, ang)
found = false
local find = ents.FindInSphere(pos, 20)
for k,v in pairs(find) do
- if ValidEntity(v) and (v:IsPlayer() or v:GetClass() == ent_surfprop) and v ~= self and v ~= self.surfer then
+ if IsValid(v) and (v:IsPlayer() or v:GetClass() == ent_surfprop) and v ~= self and v ~= self.surfer then
pos = pos + Vector(0,0,100)
found = true
break
@@ -63,13 +63,13 @@ function ENT:SpawnPlayer(pos, ang)
end
function ENT:Think()
- if not ValidEntity(self.surfer) then return end
+ if not IsValid(self.surfer) then return end
local ground = self.surfer:GetGroundEntity()
- if ground ~= self and self.surfer:IsOnGround() and ValidEntity(self.raceGame) and not self.raceGame:HasFinished(self.surfer) then -- if not on the prop and not on something else
+ if ground ~= self and self.surfer:IsOnGround() and IsValid(self.raceGame) and not self.raceGame:HasFinished(self.surfer) then -- if not on the prop and not on something else
-- reset to last checkpoint :)
local checkpoint = self.dt.lastCheckpoint
local pos = checkpoint:GetPos() + Vector(0,0,20)
- local ang = ValidEntity(checkpoint.dt.nextCheckpoint) and (checkpoint.dt.nextCheckpoint:GetPos() - checkpoint:GetPos()):Angle() or self:GetAngles()
+ local ang = IsValid(checkpoint.dt.nextCheckpoint) and (checkpoint.dt.nextCheckpoint:GetPos() - checkpoint:GetPos()):Angle() or self:GetAngles()
self:SpawnPlayer(pos, ang)
end
4 entities/entities/fadmin_jail/init.lua
View
@@ -20,7 +20,7 @@ function ENT:SetCanRemove(bool)
end
function ENT:OnRemove()
- if not self.CanRemove and ValidEntity(self.target) then
+ if not self.CanRemove and IsValid(self.target) then
local Replace = ents.Create("fadmin_jail")
Replace:SetPos(self.SolidPos)
@@ -41,7 +41,7 @@ function ENT:OnRemove()
end
function ENT:Think()
- if not ValidEntity(self.target) then
+ if not IsValid(self.target) then
self:SetCanRemove(true)
self:Remove()
return
6 entities/entities/fadmin_motd/cl_init.lua
View
@@ -29,7 +29,7 @@ function ENT:Initialize()
self.HTML:SetSize(ScrW(), ScrH() - 100)
self:LoadPage()
- self.HTML:StartAnimate(100)
+ //self.HTML:StartAnimate(100)
self.HTML:SetVisible(true)
end
@@ -57,9 +57,9 @@ function ENT:Draw()
self.LastDrawn = CurTime()
local IsAdmin = LocalPlayer():IsAdmin()
- local HasPhysgun = (ValidEntity(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physgun")
+ local HasPhysgun = (IsValid(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physgun")
- surface.SetFont("ScoreboardText")
+ surface.SetFont("TargetID")
local TextPosX = surface.GetTextSize("Physgun/use the button to see the MOTD!")*(-0.5)
local ang = self:GetAngles()
2  entities/entities/fadmin_motd/init.lua
View
@@ -18,7 +18,7 @@ function ENT:Initialize()
end
function ENT:OnRemove()
- if not self.CanRemove and ValidEntity(self.target) then
+ if not self.CanRemove and IsValid(self.target) then
local Replace = ents.Create("fadmin_motd")
Replace:SetPos(self.SolidPos)
2  entities/entities/gunlab/cl_init.lua
View
@@ -7,7 +7,7 @@ function ENT:Draw()
local Ang = self:GetAngles()
local owner = self.dt.owning_ent
- owner = (ValidEntity(owner) and owner:Nick()) or "Unknown"
+ owner = (IsValid(owner) and owner:Nick()) or "Unknown"
surface.SetFont("HUDNumber5")
local TextWidth = surface.GetTextSize("Gunlab!")
26 entities/entities/gunlab/init.lua
View
@@ -55,19 +55,21 @@ function ENT:Use(activator)
local discounted = math.ceil(185 * 0.88)
local cash = self:SalePrice(activator)
- if not activator:CanAfford(self:SalePrice(activator)) then
- GAMEMODE:Notify(activator, 1, 3, "You do not have enough money to purchase this gun.")
- return ""
- end
- local diff = (self:SalePrice(activator) - self:SalePrice(owner))
- if diff < 0 and not owner:CanAfford(math.abs(diff)) then
- GAMEMODE:Notify(activator, 2, 3, "Gun Lab owner is too poor to subsidize this sale!")
- return ""
- end
- self.sparking = true
-
if not self.Once then
self.Once = true
+
+ if not activator:CanAfford(self:SalePrice(activator)) then
+ GAMEMODE:Notify(activator, 1, 3, "You do not have enough money to purchase this gun.")
+ return ""
+ end
+ local diff = (self:SalePrice(activator) - self:SalePrice(owner))
+ if diff < 0 and not owner:CanAfford(math.abs(diff)) then
+ GAMEMODE:Notify(activator, 2, 3, "Gun Lab owner is too poor to subsidize this sale!")
+ return ""
+ end
+ self.sparking = true
+
+
activator:AddMoney(cash * -1)
GAMEMODE:Notify(activator, 0, 3, "You purchased a P228 for " .. CUR .. tostring(cash) .. "!")
@@ -88,7 +90,7 @@ function ENT:Use(activator)
end
end
end
- timer.Create(self:EntIndex() .. "spawned_weapon", 1, 1, self.createGun, self)
+ timer.Create(self:EntIndex() .. "spawned_weapon", 1, 1, function() self:createGun() end)
end
function ENT:createGun()
4 entities/entities/letter/cl_init.lua
View
@@ -51,7 +51,7 @@ local function ShowLetter(msg)
RunConsoleCommand("_DarkRP_SignLetter", Letter:EntIndex())
SignButton:SetDisabled(true)
end
- SignButton:SetDisabled(ValidEntity(Letter.dt.signed))
+ SignButton:SetDisabled(IsValid(Letter.dt.signed))
hook.Add("HUDPaint", "ShowLetter", function()
if not Letter.dt then KillLetter() return end
@@ -62,7 +62,7 @@ local function ShowLetter(msg)
local font = (LetterType == 1 and "AckBarWriting") or "Default"
draw.RoundedBox(2, ScrW() * .2, LetterY, ScrW() * .8 - (ScrW() * .2), ScrH(), Color(255, 255, 255, math.Clamp(LetterAlpha, 0, 200)))
- draw.DrawText(LetterMsg.."\n\n\nSigned by "..(ValidEntity(Letter.dt.signed) and Letter.dt.signed:Nick() or "no one"), font, ScrW() * .25 + 20, LetterY + 80, Color(0, 0, 0, LetterAlpha), 0)
+ draw.DrawText(LetterMsg.."\n\n\nSigned by "..(IsValid(Letter.dt.signed) and Letter.dt.signed:Nick() or "no one"), font, ScrW() * .25 + 20, LetterY + 80, Color(0, 0, 0, LetterAlpha), 0)
if LocalPlayer():GetPos():Distance(LetterPos) > 100 then
LetterY = Lerp(0.1, LetterY, ScrH())
2  entities/entities/letter/init.lua
View
@@ -17,7 +17,7 @@ end
function ENT:OnRemove()
local ply = self.dt.owning_ent
- if not ValidEntity(ply) then return end
+ if not IsValid(ply) then return end
if not ply.maxletters then
ply.maxletters = 0
end
2  entities/entities/microwave/cl_init.lua
View
@@ -10,7 +10,7 @@ function ENT:Draw()
local Ang = self:GetAngles()
local owner = self.dt.owning_ent
- owner = (ValidEntity(owner) and owner:Nick()) or "Unknown"
+ owner = (IsValid(owner) and owner:Nick()) or "Unknown"
surface.SetFont("HUDNumber5")
local TextWidth = surface.GetTextSize("Microwave!")
4 entities/entities/microwave/init.lua
View
@@ -90,7 +90,7 @@ function ENT:Use(activator,caller)
GAMEMODE:Notify(owner, 0, 3, "You made a " .. word .. " of " .. CUR .. tostring(math.abs(gain)) .. " by selling food!")
end
end
- timer.Create(self:EntIndex() .. "food", 1, 1, self.createFood, self)
+ timer.Create(self:EntIndex() .. "food", 1, 1, function() self:createFood() end)
end
end
@@ -125,5 +125,5 @@ end
function ENT:OnRemove()
timer.Destroy(self:EntIndex())
local ply = self.dt.owning_ent
- if not ValidEntity(ply) then return end
+ if not IsValid(ply) then return end
end
2  entities/entities/money_printer/cl_init.lua
View
@@ -10,7 +10,7 @@ function ENT:Draw()
local Ang = self:GetAngles()
local owner = self.dt.owning_ent
- owner = (ValidEntity(owner) and owner:Nick()) or "unknown"
+ owner = (IsValid(owner) and owner:Nick()) or "unknown"
surface.SetFont("HUDNumber5")
local TextWidth = surface.GetTextSize("Money printer")
12 entities/entities/money_printer/init.lua
View
@@ -17,7 +17,7 @@ function ENT:Initialize()
self.sparking = false
self.damage = 100
self.IsMoneyPrinter = true
- timer.Simple(math.random(100, 350), PrintMore, self)
+ timer.Simple(math.random(100, 350), function() PrintMore(self) end)
end
function ENT:OnTakeDamage(dmg)
@@ -50,7 +50,7 @@ function ENT:BurstIntoFlames()
self.burningup = true
local burntime = math.random(8, 18)
self:Ignite(burntime, 0)
- timer.Simple(burntime, self.Fireball, self)
+ timer.Simple(burntime, function() self:Fireball() end)
end
function ENT:Fireball()
@@ -69,14 +69,14 @@ function ENT:Fireball()
end
PrintMore = function(ent)
- if ValidEntity(ent) then
+ if IsValid(ent) then
ent.sparking = true
- timer.Simple(3, ent.CreateMoneybag, ent)
+ timer.Simple(3, function() ent:CreateMoneybag() end)
end
end
function ENT:CreateMoneybag()
- if not ValidEntity(self) then return end
+ if not IsValid(self) then return end
if self:IsOnFire() then return end
local MoneyPos = self:GetPos()
@@ -89,7 +89,7 @@ function ENT:CreateMoneybag()
DarkRPCreateMoneyBag(Vector(MoneyPos.x + 15, MoneyPos.y, MoneyPos.z + 15), amount)
self.sparking = false
- timer.Simple(math.random(100, 350), PrintMore, self)
+ timer.Simple(math.random(100, 350), function() PrintMore(self) end)
end
function ENT:Think()
19 entities/entities/phone/cl_init.lua
View
@@ -1,19 +0,0 @@
-
-include('shared.lua')
-
-/*---------------------------------------------------------
- Name: DrawTranslucent
- Desc: Draw translucent
----------------------------------------------------------*/
-function ENT:DrawTranslucent()
- self:DrawEntityOutline( 1.2 + math.sin( CurTime() * 60 ) * 0.05 )
- self:Draw()
-end
-
-function ENT:Draw()
- if not self.dt.IsBeingHeld and LocalPlayer():GetPos():Distance(self:GetPos()) < 200 then
- self:DrawEntityOutline( 1.2 + math.sin( CurTime() * 60 ) * 0.1 )
- AddWorldTip( self:EntIndex(), "YOU ARE BEING CALLED!\nUSE ME TO PICK UP THE PHONE!", 0.5, self:GetPos(), self )
- end
- self:DrawModel()
-end
134 entities/entities/phone/init.lua
View
@@ -1,134 +0,0 @@
-
-AddCSLuaFile( "cl_init.lua" )
-AddCSLuaFile( "shared.lua" )
-include('shared.lua')
-
-function ENT:Initialize()
- self:SetModel("models/weapons/w_camphone.mdl")
- self:PhysicsInit( SOLID_VPHYSICS )
- self:SetMoveType( MOVETYPE_VPHYSICS )
- self:SetSolid( SOLID_VPHYSICS )
- self:SetUseType( SIMPLE_USE )
- local phys = self:GetPhysicsObject()
- if phys:IsValid() then phys:Wake() end
-
- if self.dt.IsBeingHeld then return end--Don't make noise when already picked up
-
- self.sound = CreateSound(self, "ambient/alarms/city_firebell_loop1.wav")
- self.sound:PlayEx(0.6, 60)
- timer.Simple(2, function(ent) if ent and ent.sound then ent.sound:Stop() end end, self)
- local S = self.sound
- timer.Create("PhoneRinging"..tostring(self:EntIndex()), 3.5, 0, function(sound)
- sound:PlayEx(0.6, 60)
- timer.Simple(2, function(s) s:Stop() end, sound)
- end, S)
-end
-
-
-function ENT:Use( activator, caller )
-
- if ( !activator:IsPlayer() ) then return end
-
- -- Someone is already using the phone
- if ( self.LastUser && self.LastUser:IsValid() ) then return end
-
- if ValidEntity(self.Caller) and activator == self.Caller then return end
-
- if self.sound then
- self.sound:Stop()
- end
-
- timer.Remove("PhoneRinging"..tostring(self:EntIndex()))
-
- local head = activator:LookupBone("ValveBiped.Bip01_Head1")
- local headPos, headAng = activator:GetBonePosition(head)
- self:SetSolid(SOLID_NONE)
- self:SetPos(headPos)
-
- headAng:RotateAroundAxis(headAng:Right(), 270)
- headAng:RotateAroundAxis(headAng:Up(), 180)
- self:SetAngles(headAng)
- self:SetParent(activator)
-
- self.dt.IsBeingHeld = true
-
- if ValidEntity(self.Caller) then -- if you're BEING called and pick up the phone...
- local ply = self.Caller -- the one who called you
- ply.DarkRPVars.phone.Caller = activator -- Make sure he knows YOU picked up the phone
- ply.DarkRPVars.phone.HePickedUp = true
-
- activator:SetDarkRPVar("phone", self) -- This object is the phone you're holding
-
- activator:SendLua([[RunConsoleCommand("+voicerecord")]])
- ply:SendLua([[RunConsoleCommand("+voicerecord")]])
- timer.Create("PhoneCallCosts"..ply:EntIndex(), 20, 0, function(ply, ent) -- Make the caller pay!
- if ValidEntity(ply) and ply:CanAfford(1) then
- ply:AddMoney(-1)
- else
- ent:HangUp()
- end
- end, ply, self)
- end
-
- self.LastUser = activator
-end
-
-function ENT:Think()
- if not self.dt.owning_ent:Alive() then
- self:HangUp()
- end
- if self.HePickedUp and not ValidEntity(self.Caller) then
- self:HangUp(true)
- end
-
- if ValidEntity(self.LastUser) then
- self:SetParent()
- local head = self.LastUser:LookupBone("ValveBiped.Bip01_Head1")
- local headPos, headAng = self.LastUser:GetBonePosition(head)
- self:SetSolid(SOLID_NONE)
- self:SetPos(headPos)
-
- headAng:RotateAroundAxis(headAng:Right(), 270)
- headAng:RotateAroundAxis(headAng:Up(), 180)
- self:SetAngles(headAng)
- //self:GetPhysicsObject():EnableMotion(false)
- self:SetParent(self.LastUser)
- end
-end
-
-function ENT:HangUp(force)
- local ply = self.dt.owning_ent
- local him = self.Caller
- local HisPhone
-
- timer.Remove("PhoneCallCosts"..ply:EntIndex())
-
- if ValidEntity(him) then
- HisPhone = him.DarkRPVars.phone
- timer.Remove("PhoneCallCosts"..him:EntIndex())
- him:SendLua([[RunConsoleCommand("-voicerecord")]])
- end
-
- if ValidEntity(ply) and ply:IsPlayer() then
- ply:SendLua([[RunConsoleCommand("-voicerecord")]])
- end
-
- if ValidEntity(HisPhone) then
- self:EmitSound("buttons/combine_button2.wav", 50, 100)
- self:Remove()
- HisPhone:Remove()
- end
-
- if force then
- self:EmitSound("buttons/combine_button2.wav", 50, 100)
- self:Remove()
- end
-end
-
-function ENT:OnRemove()
- if self.sound then
- self.sound:Stop()
- end
- timer.Destroy("PhoneRinging"..tostring(self:EntIndex()))
- self:HangUp()
-end
26 entities/entities/phone/shared.lua
View
@@ -1,26 +0,0 @@
-
-
-ENT.Type = "anim"
-ENT.Base = "base_gmodentity"
-
-ENT.PrintName = "Banana phone"
-ENT.Author = "FPtje"
-ENT.Contact = ""
-ENT.Purpose = "Ring ding ding ding ding ding ding"
-ENT.Instructions = "USE ME!"
-
-ENT.Spawnable = false
-ENT.AdminSpawnable = false
-
-
-
-function ENT:SetLabel( )
- local text = "TELEPHONE FOR YOU SIR!"
- self:SetOverlayText( text )
-end
-
-function ENT:SetupDataTables()
- self:DTVar("Bool",0,"IsBeingHeld")
- self:DTVar("Entity",1,"phone")
- self:DTVar("Entity", 2, "owning_ent")
-end
17 entities/entities/spawned_shipment/cl_init.lua
View
@@ -1,4 +1,10 @@
include("shared.lua")
+surface.CreateFont("HUDNumber5", {
+ size = 44,
+ weight = 800,
+ antialias = true,
+ shadow = false,
+ font = "Trebuchet"})
local matBallGlow = Material("models/props_combine/tpballglow")
function ENT:Draw()
@@ -18,18 +24,19 @@ function ENT:Draw()
end
function ENT:drawSpawning()
- SetMaterialOverride(matBallGlow)
+ render.MaterialOverride(matBallGlow)
render.SetColorModulation(self.colr, self.colg, 0)
self:DrawModel()
+ render.MaterialOverride()
self.colr = 1 - ((CurTime() - self.StartTime) / GetConVarNumber("shipmentspawntime"))
self.colg = (CurTime() - self.StartTime) / GetConVarNumber("shipmentspawntime")
render.SetColorModulation(1, 1, 1)
- SetMaterialOverride()
+ render.MaterialOverride()
local normal = - self:GetAngles():Up()
local pos = self:LocalToWorld(Vector(0, 0, self:OBBMins().z + self.height))
@@ -45,7 +52,7 @@ end
function ENT:drawFloatingGun()
local contents = CustomShipments[self.dt.contents or ""]
- if not contents or not ValidEntity(self.dt.gunModel) then return end
+ if not contents or not IsValid(self.dt.gunModel) then return end
self.dt.gunModel:SetNoDraw(true)
local pos = self:GetPos()
@@ -74,10 +81,10 @@ function ENT:drawFloatingGun()
min, max = self.dt.gunModel:LocalToWorld(min), self.dt.gunModel:LocalToWorld(max)
-- Draw the ghosted weapon
- SetMaterialOverride(matBallGlow)
+ render.MaterialOverride(matBallGlow)
render.SetColorModulation(1 - delta, delta, 0) -- From red to green
self.dt.gunModel:DrawModel()
- SetMaterialOverride()
+ render.MaterialOverride()
render.SetColorModulation(1, 1, 1)
-- Draw the cut-off weapon
8 entities/entities/spawned_shipment/init.lua
View
@@ -10,7 +10,7 @@ function ENT:Initialize()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self.locked = true
- timer.Simple(GetConVarNumber("shipmentspawntime"), function() if ValidEntity(self) then self.locked = false end end)
+ timer.Simple(GetConVarNumber("shipmentspawntime"), function() if IsValid(self) then self.locked = false end end)
self.damage = 100
self.ShareGravgun = true
local phys = self:GetPhysicsObject()
@@ -20,7 +20,7 @@ function ENT:Initialize()
-- Create a serverside gun model
-- it's required serverside to be able to get OBB information clientside
- self.dt.gunModel = ValidEntity(self.dt.gunModel) and self.dt.gunModel or ents.Create("prop_physics")
+ self.dt.gunModel = IsValid(self.dt.gunModel) and self.dt.gunModel or ents.Create("prop_physics")
self.dt.gunModel:SetModel(contents.model)
self.dt.gunModel:SetPos(self:GetPos())
self.dt.gunModel:Spawn()
@@ -51,12 +51,12 @@ function ENT:Use()
self.locked = true -- One activation per second
self.sparking = true
self.dt.gunspawn = CurTime() + 1
- timer.Create(self:EntIndex() .. "crate", 1, 1, self.SpawnItem, self)
+ timer.Create(self:EntIndex() .. "crate", 1, 1, function() self.SpawnItem(self) end)
end
end
function ENT:SpawnItem()
- if not ValidEntity(self) then return end
+ if not IsValid(self) then return end
timer.Destroy(self:EntIndex() .. "crate")
self.sparking = false
local count = self.dt.count
18 entities/weapons/arrest_stick/shared.lua
View
@@ -47,21 +47,21 @@ function SWEP:Initialize()
end
function SWEP:Deploy()
- if CLIENT or not ValidEntity(self:GetOwner()) then return end
- self:SetColor(255,0,0,255)
+ if CLIENT or not IsValid(self:GetOwner()) then return end
+ self:SetColor(Color(255,0,0,255))
self:SetMaterial("models/shiny")
SendUserMessage("StunStickColour", self:GetOwner(), 255,0,0, "models/shiny")
return true
end
function SWEP:Holster()
- if CLIENT or not ValidEntity(self:GetOwner()) then return end
+ if CLIENT or not IsValid(self:GetOwner()) then return end
SendUserMessage("StunStickColour", self:GetOwner(), 255, 255, 255, "")
return true
end
function SWEP:OnRemove()
- if SERVER and ValidEntity(self:GetOwner()) then
+ if SERVER and IsValid(self:GetOwner()) then
SendUserMessage("StunStickColour", self:GetOwner(), 255, 255, 255, "")
end
end
@@ -69,7 +69,7 @@ end
usermessage.Hook("StunStickColour", function(um)
local viewmodel = LocalPlayer():GetViewModel()
local r,g,b,a = um:ReadLong(), um:ReadLong(), um:ReadLong(), 255
- viewmodel:SetColor(r,g,b,a)
+ viewmodel:SetColor(Color(r,g,b,a))
viewmodel:SetMaterial(um:ReadString())
end)
@@ -77,7 +77,7 @@ function SWEP:PrimaryAttack()
if CurTime() < self.NextStrike then return end
self:SetWeaponHoldType("melee")
- timer.Simple(0.3, function(wep) if wep:IsValid() then wep:SetWeaponHoldType("normal") end end, self)
+ timer.Simple(0.3, function() if self:IsValid() then self:SetWeaponHoldType("normal") end end)
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Weapon:EmitSound(self.Sound)
@@ -89,7 +89,7 @@ function SWEP:PrimaryAttack()
local trace = self.Owner:GetEyeTrace()
- if ValidEntity(trace.Entity) and trace.Entity:IsPlayer() and trace.Entity:IsCP() and GetConVarNumber("cpcanarrestcp") == 0 then
+ if IsValid(trace.Entity) and trace.Entity:IsPlayer() and trace.Entity:IsCP() and GetConVarNumber("cpcanarrestcp") == 0 then
GAMEMODE:Notify(self.Owner, 1, 5, "You can not arrest other CPs!")
return
end
@@ -103,7 +103,7 @@ function SWEP:PrimaryAttack()
end
end
- if not ValidEntity(trace.Entity) or (self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 115) or (not trace.Entity:IsPlayer() and not trace.Entity:IsNPC()) then
+ if not IsValid(trace.Entity) or (self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 115) or (not trace.Entity:IsPlayer() and not trace.Entity:IsNPC()) then
return
end
@@ -135,7 +135,7 @@ function SWEP:PrimaryAttack()
GAMEMODE:Notify(trace.Entity, 0, 20, "You've been arrested by " .. self.Owner:Nick())
if self.Owner.SteamName then
- DB.Log(self.Owner:SteamName().." ("..self.Owner:SteamID()..") arrested "..trace.Entity:Nick())
+ DB.Log(self.Owner:SteamName().." ("..self.Owner:SteamID()..") arrested "..trace.Entity:Nick(), nil, Color(0, 255, 255))
end
else
GAMEMODE:Notify(self.Owner, 1, 4, "You can't arrest players who are spawning.")
2  entities/weapons/door_ram/shared.lua
View
@@ -80,7 +80,7 @@ function SWEP:PrimaryAttack()
local trace = self.Owner:GetEyeTrace()
self.Weapon:SetNextPrimaryFire(CurTime() + 2.5)
- if (not ValidEntity(trace.Entity) or (not trace.Entity:IsDoor() and not trace.Entity:IsVehicle() and trace.Entity:GetClass() ~= "prop_physics")) then
+ if (not IsValid(trace.Entity) or (not trace.Entity:IsDoor() and not trace.Entity:IsVehicle() and trace.Entity:GetClass() ~= "prop_physics")) then
return
end
18 entities/weapons/gmod_tool/stools/checkpoint_setter.lua
View
@@ -8,14 +8,14 @@ if CLIENT then
end
function TOOL:LeftClick(trace)
- if not ValidEntity(self:GetSWEP():GetNWEntity("Game")) or CLIENT then return end
+ if not IsValid(self:GetSWEP():GetNWEntity("Game")) or CLIENT then return end
local pos, ang = self:CalcPosAng(self:GetOwner())
if not self:GetWeapon():GetNWBool("RadiusMode") and pos then
local checkpoint = self:GetSWEP():GetNWEntity("Game"):addCheckpoint(pos, ang)
- if ValidEntity(checkpoint) and checkpoint:GetClass() == "ent_checkpoint" then
+ if IsValid(checkpoint) and checkpoint:GetClass() == "ent_checkpoint" then
self:GetWeapon():SetNWBool("Radiusmode", true)
self:GetOwner():ChatPrint("Now left click to select the radius!")
self.Checkpoint = checkpoint
@@ -30,18 +30,18 @@ end
function TOOL:RightClick(trace)
local pos, ang = self:CalcPosAng(self:GetOwner())
- if not ValidEntity(self:GetSWEP():GetNWEntity("Game")) or CLIENT or not pos then return end
+ if not IsValid(self:GetSWEP():GetNWEntity("Game")) or CLIENT or not pos then return end
self:GetSWEP():GetNWEntity("Game"):createFinish(self:CalcPosAng(self:GetOwner()))
end
function TOOL:UpdateGhostCheckpoint(ent, ply)
- if not ValidEntity(ent) then return end
+ if not IsValid(ent) then return end
local model = self:GetSWEP():GetNWString("nextEntity") == "start" and "models/props_c17/truss02a.mdl" or "models/XQM/Rails/gumball_1.mdl"
ent:SetModel(model)
ent:SetNoDraw(false)
-
+
local pos, ang = self:CalcPosAng(self:GetOwner())
if not pos then ent:SetNoDraw(true) return end
@@ -71,22 +71,22 @@ function TOOL:CalcPosAng(ply)
Ang.pitch = Ang.pitch + 90
Ang.yaw = self:GetOwner():EyeAngles().yaw
- local min = ValidEntity(ent) and ent:OBBMins() or Vector(0,0,-128)
+ local min = IsValid(ent) and ent:OBBMins() or Vector(0,0,-128)
local pos = trace.HitPos - trace.HitNormal * min.z * 0.5
if self:GetSWEP():GetNWString("nextEntity") == "start" then
pos = pos - Vector(0,0,67)
end
-
+
return pos, Ang
end
function TOOL:Think()
- --if SERVER and not ValidEntity(self:GetSWEP():GetNWEntity("Game")) then return end
+ --if SERVER and not IsValid(self:GetSWEP():GetNWEntity("Game")) then return end
if not self.GhostEntity or not self.GhostEntity:IsValid() then
local model = self:GetSWEP():GetNWString("nextEntity") == "start" and "models/props_c17/truss02a.mdl" or "models/XQM/Rails/gumball_1.mdl"
self:MakeGhostEntity(model, Vector(0,0,0), Angle(0,0,0) )
end
-
+
self:UpdateGhostCheckpoint(self.GhostEntity, self:GetOwner())
if SERVER and self:GetWeapon():GetNWBool("RadiusMode") then
16 entities/weapons/gmod_tool/stools/shareprops.lua
View
@@ -4,31 +4,31 @@ TOOL.Command = nil
TOOL.ConfigName = ""
function TOOL:RightClick(trace)
- if not ValidEntity(trace.Entity) or CLIENT then return true end
-
+ if not IsValid(trace.Entity) or CLIENT then return true end
+
local ply = self:GetOwner()
-
+
trace.Entity.SharePhysgun = nil
trace.Entity.ShareGravgun = nil
trace.Entity.SharePlayerUse = nil
trace.Entity.ShareDamage = nil
trace.Entity.ShareToolgun = nil
-
+
trace.Entity.AllowedPlayers = nil
return true
end
function TOOL:LeftClick(trace)
- if not ValidEntity(trace.Entity) or CLIENT then return true end
-
+ if not IsValid(trace.Entity) or CLIENT then return true end
+
local ply = self:GetOwner()
-
+
local Physgun = trace.Entity.SharePhysgun or false
local GravGun = trace.Entity.ShareGravgun or false
local PlayerUse = trace.Entity.SharePlayerUse or false
local Damage = trace.Entity.ShareDamage or false
local Toolgun = trace.Entity.ShareToolgun or false
-
+
-- This big usermessage will be too big if you select 63 players, since that will not happen I can't be arsed to solve it
umsg.Start("FPP_ShareSettings", ply)
umsg.Entity(trace.Entity)
19 entities/weapons/keys/shared.lua
View
@@ -47,7 +47,7 @@ end
function SWEP:PrimaryAttack()
local trace = self.Owner:GetEyeTrace()
- if not ValidEntity(trace.Entity) or not trace.Entity:IsOwnable() or (trace.Entity.DoorData and trace.Entity.DoorData.NonOwnable) or (trace.Entity:IsDoor() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 65) or (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 100) then
+ if not IsValid(trace.Entity) or not trace.Entity:IsOwnable() or (trace.Entity.DoorData and trace.Entity.DoorData.NonOwnable) or (trace.Entity:IsDoor() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 65) or (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 100) then
if CLIENT then RunConsoleCommand("_DarkRP_AnimationMenu") end
return
end
@@ -70,7 +70,7 @@ function SWEP:PrimaryAttack()
self.Owner:EmitSound("npc/metropolice/gear".. math.floor(math.Rand(1,7)) ..".wav")
trace.Entity:KeysLock() -- Lock the door immediately so it won't annoy people
- timer.Simple(0.9, function(ply, sound) if ValidEntity(ply) then ply:EmitSound(sound) end end, self.Owner, self.Sound)
+ timer.Simple(0.9, function() if IsValid(self.Owner) then self.Owner:EmitSound(self.Sound) end end)
local RP = RecipientFilter()
RP:AddAllPlayers()
@@ -79,7 +79,7 @@ function SWEP:PrimaryAttack()
umsg.Entity(self.Owner)
umsg.String("usekeys")
umsg.End()
- self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_ITEM_PLACE)
+ self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_ITEM_PLACE, true)
end
self.Weapon:SetNextPrimaryFire(CurTime() + 0.3)
else
@@ -92,7 +92,7 @@ function SWEP:PrimaryAttack()
umsg.String("knocking")
umsg.End()
- self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST)
+ self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST, true)
end
end
self.Weapon:SetNextPrimaryFire(CurTime() + 0.2)
@@ -102,7 +102,7 @@ end
function SWEP:SecondaryAttack()
local trace = self.Owner:GetEyeTrace()
- if not ValidEntity(trace.Entity) or not trace.Entity:IsOwnable() or (trace.Entity.DoorData and trace.Entity.DoorData.NonOwnable) or (trace.Entity:IsDoor() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 65) or (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 100) then
+ if not IsValid(trace.Entity) or not trace.Entity:IsOwnable() or (trace.Entity.DoorData and trace.Entity.DoorData.NonOwnable) or (trace.Entity:IsDoor() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 65) or (trace.Entity:IsVehicle() and self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 100) then
if CLIENT then RunConsoleCommand("_DarkRP_AnimationMenu") end
return
end
@@ -122,13 +122,14 @@ function SWEP:SecondaryAttack()
if SERVER then
self.Owner:EmitSound("npc/metropolice/gear".. math.floor(math.Rand(1,7)) ..".wav")
trace.Entity:KeysUnLock() -- Unlock the door immediately so it won't annoy people
- timer.Simple(0.9, function(ply, sound) if ValidEntity(ply) then ply:EmitSound(sound) end end, self.Owner, self.Sound)
+
+ timer.Simple(0.9, function() if IsValid(self.Owner) then self.Owner:EmitSound(self.Sound) end end)
umsg.Start("anim_keys", RP)
umsg.Entity(self.Owner)
umsg.String("usekeys")
umsg.End()
- self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_ITEM_PLACE)
+ self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_ITEM_PLACE, true)
end
self.Weapon:SetNextSecondaryFire(CurTime() + 0.3)
else
@@ -141,7 +142,7 @@ function SWEP:SecondaryAttack()
umsg.String("knocking")
umsg.End()
- self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST)
+ self.Owner:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST, true)
end
end
self.Weapon:SetNextSecondaryFire(CurTime() + 0.2)
@@ -151,7 +152,7 @@ end
SWEP.OnceReload = false
function SWEP:Reload()
local trace = self.Owner:GetEyeTrace()
- if not ValidEntity(trace.Entity) or (ValidEntity(trace.Entity) and ((not trace.Entity:IsDoor() and not trace.Entity:IsVehicle()) or self.Owner:EyePos():Distance(trace.HitPos) > 200)) then
+ if not IsValid(trace.Entity) or (IsValid(trace.Entity) and ((not trace.Entity:IsDoor() and not trace.Entity:IsVehicle()) or self.Owner:EyePos():Distance(trace.HitPos) > 200)) then
if not self.OnceReload then
if SERVER then GAMEMODE:Notify(self.Owner, 1, 3, "You need to be looking at a door/vehicle in order to bring up the menu") end
self.OnceReload = true
44 entities/weapons/lockpick/shared.lua
View
@@ -50,17 +50,17 @@ if CLIENT then
usermessage.Hook("lockpick_time", function(um)
local wep = um:ReadEntity()
local time = um:ReadLong()
-
+
wep.LockPickTime = time
wep.EndPick = CurTime() + time
end)
-
+
usermessage.Hook("IsFadingDoor", function(um) -- Set isFadingDoor clientside (this is the best way I could think of to do this, if anyone can think of a better way feel free to change it.
local door = um:ReadEntity()
- if ValidEntity(door) then
+ if IsValid(door) then
door.isFadingDoor = true
end
- end)
+ end)
end
/*---------------------------------------------------------
@@ -74,7 +74,7 @@ function SWEP:PrimaryAttack()
local trace = self.Owner:GetEyeTrace()
local e = trace.Entity
if SERVER and e.isFadingDoor then SendUserMessage("IsFadingDoor", self.Owner, e) end -- The fading door tool only sets isFadingDoor serverside, for the lockpick to work we need this to be set clientside too.
- if ValidEntity(e) and trace.HitPos:Distance(self.Owner:GetShootPos()) <= 100 and (e:IsDoor() or e:IsVehicle() or string.find(string.lower(e:GetClass()), "vehicle") or e.isFadingDoor) then
+ if IsValid(e) and trace.HitPos:Distance(self.Owner:GetShootPos()) <= 100 and (e:IsDoor() or e:IsVehicle() or string.find(string.lower(e:GetClass()), "vehicle") or e.isFadingDoor) then
self.IsLockPicking = true
self.StartPick = CurTime()
if SERVER then
@@ -84,27 +84,27 @@ function SWEP:PrimaryAttack()
umsg.Long(self.LockPickTime)
umsg.End()
end
-
+
self.EndPick = CurTime() + self.LockPickTime
-
+
self:SetWeaponHoldType("pistol")
-
+
if SERVER then
- timer.Create("LockPickSounds", 1, self.LockPickTime, function(wep)
- if not ValidEntity(wep) then return end
+ timer.Create("LockPickSounds", 1, self.LockPickTime, function()
+ if not IsValid(self) then return end
local snd = {1,3,4}
- wep:EmitSound("weapons/357/357_reload".. tostring(snd[math.random(1, #snd)]) ..".wav", 50, 100)
- end, self)
+ self:EmitSound("weapons/357/357_reload".. tostring(snd[math.random(1, #snd)]) ..".wav", 50, 100)
+ end)
elseif CLIENT then
self.Dots = self.Dots or ""
- timer.Create("LockPickDots", 0.5, 0, function(wep)
- if not wep:IsValid() then timer.Destroy("LockPickDots") return end
- local len = string.len(wep.Dots)
+ timer.Create("LockPickDots", 0.5, 0, function()
+ if not self:IsValid() then timer.Destroy("LockPickDots") return end
+ local len = string.len(self.Dots)
local dots = {[0]=".", [1]="..", [2]="...", [3]=""}
- wep.Dots = dots[len]
- end, self)
+ self.Dots = dots[len]
+ end)
end
- end
+ end
end
function SWEP:Holster()
@@ -123,7 +123,7 @@ function SWEP:Succeed()
trace.Entity:fadeActivate()
timer.Simple(5, function() if trace.Entity.fadeActive then trace.Entity:fadeDeactivate() end end)
end
- elseif ValidEntity(trace.Entity) and trace.Entity.Fire then
+ elseif IsValid(trace.Entity) and trace.Entity.Fire then
trace.Entity:Fire("unlock", "", .5)
trace.Entity:Fire("open", "", .6)
trace.Entity:Fire("setanimation","open",.6)
@@ -142,7 +142,7 @@ end
function SWEP:Think()
if self.IsLockPicking then
local trace = self.Owner:GetEyeTrace()
- if not ValidEntity(trace.Entity) then
+ if not IsValid(trace.Entity) then
self:Fail()
end
if trace.HitPos:Distance(self.Owner:GetShootPos()) > 100 or (not trace.Entity:IsDoor() and not trace.Entity:IsVehicle() and not string.find(string.lower(trace.Entity:GetClass()), "vehicle") and not trace.Entity.isFadingDoor) then
@@ -161,13 +161,13 @@ function SWEP:DrawHUD()
local h = ScrH()
local x,y,width,height = w/2-w/10, h/ 2, w/5, h/15
draw.RoundedBox(8, x, y, width, height, Color(10,10,10,120))
-
+
local time = self.EndPick - self.StartPick
local curtime = CurTime() - self.StartPick
local status = curtime/time
local BarWidth = status * (width - 16) + 8
draw.RoundedBox(8, x+8, y+8, BarWidth, height - 16, Color(255-(status*255), 0+(status*255), 0, 255))
-
+
draw.SimpleText("Picking lock"..self.Dots, "Trebuchet24", w/2, h/2 + height/2, Color(255,255,255,255), 1, 1)
end
end
6 entities/weapons/ls_snip_base/shared.lua
View
@@ -120,7 +120,7 @@ SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
- if not ValidEntity(self.Owner) then return end
+ if not IsValid(self.Owner) then return end
if not self.IronSightsPos then return end
if (self.NextSecondaryAttack > CurTime()) then return end
@@ -158,7 +158,7 @@ function SWEP:SecondaryAttack()
end
function SWEP:Holster()
- if not ValidEntity(self.Owner) then return end
+ if not IsValid(self.Owner) then return end
if (SERVER) then
self.Owner:SetFOV(0, 0)
end
@@ -170,7 +170,7 @@ function SWEP:Holster()
end
function SWEP:Reload()
- if not ValidEntity(self.Owner) then return end
+ if not IsValid(self.Owner) then return end
if (SERVER) then
self.Owner:SetFOV(0, 0)
end
50 entities/weapons/med_kit/shared.lua
View
@@ -35,8 +35,8 @@ function SWEP:createViewModels()
local viewmodel = self:GetOwner():GetViewModel()
self.viewModels = {}
- self.viewModels[1] = self.viewModels[1] or ents.Create("prop_physics")
- self.viewModels[2] = self.viewModels[2] or ents.Create("prop_physics")
+ self.viewModels[1] = self.viewModels[1] or ents.CreateClientProp()
+ self.viewModels[2] = self.viewModels[2] or ents.CreateClientProp()
self.viewModels[1]:SetAngles(viewmodel:GetAngles())
self.viewModels[2]:SetAngles(viewmodel:GetAngles())
@@ -57,9 +57,9 @@ function SWEP:createViewModels()
end)
for k,v in pairs(self.viewModels) do
-
+ v:SetRenderMode()
v:SetModel("models/Mechanics/roboticslarge/a2.mdl")
- v:SetColor(255,0,0,255)
+ v:SetColor(Color(255,0,0,255))
v:SetMaterial("models/debug/debugwhite")
v:SetModelScale(Vector(0.1,0.1,0.1))
@@ -73,7 +73,7 @@ end
function SWEP:Think()
if SERVER then return end
- if not self.viewModels or not ValidEntity(self.viewModels[1]) then
+ if not self.viewModels or not IsValid(self.viewModels[1]) then
self:createViewModels()
end
@@ -96,7 +96,7 @@ function SWEP:Deploy()
end
function SWEP:Holster()
- if SERVER and ValidEntity(self:GetOwner()) then
+ if SERVER and IsValid(self:GetOwner()) then
SendUserMessage("med_kit_model", self:GetOwner(), self)
return true
end
@@ -105,7 +105,7 @@ end
if CLIENT then
usermessage.Hook("med_kit_model", function(um)
local ent = um:ReadEntity()
- if ValidEntity(ent) then
+ if IsValid(ent) then
for k,v in pairs(ent.viewModels or {}) do
SafeRemoveEntity(v)
end
@@ -115,20 +115,30 @@ end
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
- trace = {}
- trace.start = self.Owner:GetShootPos()
- trace.endpos = trace.start + (self.Owner:GetAimVector() * 85)
- trace.filter = { self.Owner, self.Weapon }
- tr = util.TraceLine(trace)
-
- if (tr.HitNonWorld) and SERVER then
- local enthit = tr.Entity
- local maxhealth = enthit.StartHealth or 100
- if enthit:IsPlayer() and enthit:Health() < maxhealth then
- enthit:SetHealth(enthit:Health() + 1)
- self.Owner:EmitSound("hl1/fvox/boop.wav", 150, enthit:Health())
+
+ local found
+ local lastDot = -1 -- the opposite of what you're looking at
+ local aimVec = self.Owner:GetAimVector()
+
+ for k,v in pairs(player.GetAll()) do
+ local maxhealth = v.StartHealth or 100
+ if v == self.Owner or v:GetShootPos():Distance(self.Owner:GetShootPos()) > 85 or v:Health() >= maxhealth then continue end
+
+ local direction = v:GetShootPos() - self.Owner:GetShootPos()
+ direction:Normalize()
+ local dot = direction:Dot(aimVec)
+
+ -- Looking more in the direction of this player
+ if dot > lastDot then
+ lastDot = dot
+ found = v
end
end
+
+ if found then
+ found:SetHealth(found:Health() + 1)
+ self.Owner:EmitSound("hl1/fvox/boop.wav", 150, found:Health())
+ end
end
function SWEP:SecondaryAttack()
@@ -141,7 +151,7 @@ function SWEP:SecondaryAttack()
end
function SWEP:OnRemove()
- if SERVER and ValidEntity(self:GetOwner()) then
+ if SERVER and IsValid(self:GetOwner()) then
SendUserMessage("med_kit_model", self:GetOwner(), self)
end
end
27 entities/weapons/pocket/shared.lua
View
@@ -1,4 +1,3 @@
-require("datastream")
if SERVER then
AddCSLuaFile("shared.lua")
end
@@ -56,7 +55,7 @@ function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire(CurTime() + 0.2)
local trace = self.Owner:GetEyeTrace()
- if not ValidEntity(trace.Entity) or (SERVER and trace.Entity:IsPlayerHolding()) then
+ if not IsValid(trace.Entity) or (SERVER and trace.Entity:IsPlayerHolding()) then
return
end
@@ -65,7 +64,7 @@ function SWEP:PrimaryAttack()
end
self:SetWeaponHoldType("pistol")
- timer.Simple(0.2, function(wep) if wep:IsValid() then wep:SetWeaponHoldType("normal") end end, self)
+ timer.Simple(0.2, function() if self:IsValid() then self:SetWeaponHoldType("normal") end end)
if CLIENT then return end
@@ -124,11 +123,11 @@ function SWEP:SecondaryAttack()
end
self:NewSetWeaponHoldType("pistol")
- timer.Simple(0.2, function(wep) if wep:IsValid() then wep:NewSetWeaponHoldType("normal") end end, self)
+ timer.Simple(0.2, function() if self:IsValid() then self:NewSetWeaponHoldType("normal") end end)
local ent = self.Owner:GetTable().Pocket[#self.Owner:GetTable().Pocket]
self.Owner:GetTable().Pocket[#self.Owner:GetTable().Pocket] = nil
- if not ValidEntity(ent) then GAMEMODE:Notify(self.Owner, 1, 4, "Your pocket contains no items.") return end
+ if not IsValid(ent) then GAMEMODE:Notify(self.Owner, 1, 4, "Your pocket contains no items.") return end
local trace = {}
trace.start = self.Owner:EyePos()
@@ -162,7 +161,7 @@ function SWEP:Reload()
end
for k,v in pairs(self.Owner:GetTable().Pocket) do
- if not ValidEntity(v) then
+ if not IsValid(v) then
self.Owner:GetTable().Pocket[k] = nil
self.Owner:GetTable().Pocket = table.ClearKeys(self.Owner:GetTable().Pocket)
if #self.Owner:GetTable().Pocket <= 0 then -- Recheck after the entities have been validated.
@@ -181,7 +180,7 @@ if CLIENT then
LocalPlayer():GetTable().Pocket = LocalPlayer():GetTable().Pocket or {}
local ent = Entity(um:ReadShort())
- if ValidEntity(ent) and not table.HasValue(LocalPlayer():GetTable().Pocket, ent) then
+ if IsValid(ent) and not table.HasValue(LocalPlayer():GetTable().Pocket, ent) then
table.insert(LocalPlayer():GetTable().Pocket, ent)
end
end
@@ -202,7 +201,7 @@ if CLIENT then
if frame and frame:IsValid() and frame:IsVisible() then return end
if LocalPlayer():GetActiveWeapon():GetClass() ~= "pocket" then return end
if not LocalPlayer():GetTable().Pocket then LocalPlayer():GetTable().Pocket = {} return end
- for k,v in pairs(LocalPlayer():GetTable().Pocket) do if not ValidEntity(v) then table.remove(LocalPlayer():GetTable().Pocket, k) end end
+ for k,v in pairs(LocalPlayer():GetTable().Pocket) do if not IsValid(v) then table.remove(LocalPlayer():GetTable().Pocket, k) end end
if #LocalPlayer():GetTable().Pocket <= 0 then return end
LocalPlayer():GetTable().Pocket = table.ClearKeys(LocalPlayer():GetTable().Pocket)
frame = vgui.Create( "DFrame" )
@@ -215,10 +214,10 @@ if CLIENT then
frame:SetSize( #items * 64, 90 )
frame:Center()
for k,v in pairs(items) do
- if not ValidEntity(v) then
+ if not IsValid(v) then
items[k] = nil
for a,b in pairs(LocalPlayer().Pocket) do
- if b == v or not ValidEntity(b) then
+ if b == v or not IsValid(b) then
LocalPlayer():GetTable().Pocket[a] = nil
end
end
@@ -230,7 +229,7 @@ if CLIENT then
local icon = vgui.Create("SpawnIcon", frame)
icon:SetPos((k-1) * 64, 25)
icon:SetModel(v:GetModel())
- icon:SetIconSize(64)
+ icon:SetSize(64, 64)
icon:SetToolTip()
icon.DoClick = function()
icon:SetToolTip()
@@ -248,7 +247,7 @@ if CLIENT then
items = table.ClearKeys(items)
Reload()
LocalPlayer():GetActiveWeapon():SetWeaponHoldType("pistol")
- timer.Simple(0.2, function(wep) if wep:IsValid() then wep:SetWeaponHoldType("normal") end end, LocalPlayer():GetActiveWeapon())
+ timer.Simple(0.2, function() if LocalPlayer():GetActiveWeapon():IsValid() then LocalPlayer():GetActiveWeapon():SetWeaponHoldType("normal") end end)
end
end
end
@@ -261,7 +260,7 @@ elseif SERVER then
if ply:GetActiveWeapon():GetClass() ~= "pocket" then
return
end
- if ply:GetTable().Pocket and ValidEntity(Entity(tonumber(args[1]))) then
+ if ply:GetTable().Pocket and IsValid(Entity(tonumber(args[1]))) then
local ent = Entity(tonumber(args[1]))
if not table.HasValue(ply.Pocket, ent) then return end
@@ -273,7 +272,7 @@ elseif SERVER then
ply:GetTable().Pocket = table.ClearKeys(ply:GetTable().Pocket)
ply:GetActiveWeapon():SetWeaponHoldType("pistol")
- timer.Simple(0.2, function(wep) if wep:IsValid() then wep:SetWeaponHoldType("normal") end end, ply:GetActiveWeapon())
+ timer.Simple(0.2, function() if ply:GetActiveWeapon():IsValid() then ply:GetActiveWeapon():SetWeaponHoldType("normal") end end)
local trace = {}
trace.start = ply:EyePos()
22 entities/weapons/stunstick/shared.lua
View
@@ -43,21 +43,21 @@ SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = ""
function SWEP:Deploy()
- if CLIENT or not ValidEntity(self:GetOwner()) then return end
- self:SetColor(0,0,255,255)
+ if CLIENT or not IsValid(self:GetOwner()) then return end
+ self:SetColor(Color(0,0,255,255))
self:SetMaterial("models/shiny")
SendUserMessage("StunStickColour", self:GetOwner(), 0,0,255, "models/shiny")
return true
end
function SWEP:Holster()
- if CLIENT or not ValidEntity(self:GetOwner()) then return end
+ if CLIENT or not IsValid(self:GetOwner()) then return end
SendUserMessage("StunStickColour", self:GetOwner(), 255, 255, 255, "")
return true
end
function SWEP:OnRemove()
- if SERVER and ValidEntity(self:GetOwner()) then
+ if SERVER and IsValid(self:GetOwner()) then
SendUserMessage("StunStickColour", self:GetOwner(), 255, 255, 255, "")
end
end
@@ -65,7 +65,7 @@ end
usermessage.Hook("StunStickColour", function(um)
local viewmodel = LocalPlayer():GetViewModel()
local r,g,b,a = um:ReadLong(), um:ReadLong(), um:ReadLong(), 255
- viewmodel:SetColor(r,g,b,a)
+ viewmodel:SetColor(Color(r,g,b,a))
viewmodel:SetMaterial(um:ReadString())
end)
@@ -84,7 +84,7 @@ function SWEP:Initialize()
end
function SWEP:DoFlash(ply)
- if not ValidEntity(ply) or not ply:IsPlayer() then return end
+ if not IsValid(ply) or not ply:IsPlayer() then return end
umsg.Start("StunStickFlash", ply)
umsg.End()
end
@@ -93,7 +93,7 @@ function SWEP:PrimaryAttack()
if CurTime() < self.NextStrike then return end
self:SetWeaponHoldType("melee")
- timer.Simple(0.3, function(wep) if wep:IsValid() then wep:SetWeaponHoldType("normal") end end, self)
+ timer.Simple(0.3, function() if self:IsValid() then self:SetWeaponHoldType("normal") end end)
self.Owner:SetAnimation(PLAYER_ATTACK1)
self.Weapon:EmitSound(self.Sound)
@@ -105,7 +105,7 @@ function SWEP:PrimaryAttack()
local trace = self.Owner:GetEyeTrace()
- if not ValidEntity(trace.Entity) or (self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 100) then return end
+ if not IsValid(trace.Entity) or (self.Owner:EyePos():Distance(trace.Entity:GetPos()) > 100) then return end
if not trace.Entity:IsDoor() then
trace.Entity:SetVelocity((trace.Entity:GetPos() - self.Owner:GetPos()) * 7)
@@ -136,13 +136,13 @@ function SWEP:SecondaryAttack()
self.NextStrike = CurTime() + .3