Skip to content

Commit

Permalink
v1.3.0_101017
Browse files Browse the repository at this point in the history
soundURLPurge() fixed
setPlayerColor / setWeaponColor fixed
soundPlaySingle function added
Added entity admin check
playerIsRagdoll function fix
hasGodMode function fix
  • Loading branch information
tengzl33t committed Oct 10, 2017
1 parent ae00698 commit b52cdec
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ E2Power или E2P - это дополнение для Wiremod, а точнее
+ Добавлены функции entity:setWeaponColor(v), entity:setPlayerColor(v), entity:getWeaponColor(), entity:getPlayerColor().
+ Изменен лимит размера партиклей с 3000 до 800.
+ Пофикшены некоторые функции в Tool.lua, diff.lua и health.lua.
+ Проверка на админа при спавне некоторых entity.

## Авторы

Expand Down
10 changes: 3 additions & 7 deletions lua/entities/gmod_wire_expression2/core/custom/entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ local function createentitysfromE2(self,entity,pos,angles,freeze)
if entity:lower():find(i) and not self.player:GetNWBool("E2PowerAccess") then return end
end


if ( IsValid( self.player ) && !self.player:IsAdmin() ) then -- Проверка на права админа, при спавне некоторых entity.
if ( scripted_ents.GetMember( entity, "AdminOnly" ) ) then return end
end

local ent = ents.Create(entity)
if not IsValid(ent) then return nil end
Expand All @@ -63,12 +65,6 @@ local function createentitysfromE2(self,entity,pos,angles,freeze)
phys:Wake()
if freeze then phys:EnableMotion( false ) end
end
--ent.OnDieFunctions.GetCountUpdate.Function2 = ent.OnDieFunctions.GetCountUpdate.Function
--ent.OnDieFunctions.GetCountUpdate.Function = function(self,player,class)
-- if CLIENT then return end
-- E2totalspawnedentitys=E2totalspawnedentitys-1
-- self.OnDieFunctions.GetCountUpdate.Function2(self,player,class)
--end
E2totalspawnedentitys = E2totalspawnedentitys+1
E2tempSpawnedEntitys = E2tempSpawnedEntitys+1
if E2tempSpawnedEntitys==1 then
Expand Down
14 changes: 7 additions & 7 deletions lua/entities/gmod_wire_expression2/core/custom/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ end
local dmgType1 = nil

__e2setcost(50)
local function takeDmg(Ent, Amount, Type, Force, Attacker, Inflictor)
local function takeDmg(Ent, Ply, Amount, Type, Force, Attacker, Inflictor)
local dmgInfo = DamageInfo()
dmgInfo:AddDamage(Amount)
dmgInfo:SetDamageType( dmgType[Type:lower()] or 0 )
dmgInfo:SetAttacker(Attacker or self.player)
dmgInfo:SetInflictor(Inflictor or self.player)
dmgInfo:SetDamageForce( Forse or Vector(0,0,0) )
dmgInfo:SetAttacker(Attacker or Ply)
dmgInfo:SetInflictor(Inflictor or Ply)
dmgInfo:SetDamageForce( Force or Vector(0,0,0) )

Ent:TakeDamageInfo(dmgInfo)
end
Expand All @@ -240,19 +240,19 @@ end
e2function void entity:takeDamage(number Amount,string Type)
if !IsValid(this) then return end
if !isOwner(self, this) then return end
takeDmg(this,Amount,Type)
takeDmg(this, self.player, Amount, Type)
end

e2function void entity:takeDamage(number Amount, string Type, vector Force)
if !IsValid(this) then return end
if !isOwner(self, this) then return end
takeDmg(this,Amount,Type,Vector(Force[1],Force[2],Force[3]))
takeDmg(this, self.player, Amount, Type, Vector(Force[1],Force[2],Force[3]))
end

e2function void entity:takeDamage(number Amount, string Type, vector Force, entity Attacker, entity Inflictor)
if !IsValid(this) then return end
if !isOwner(self, this) then return end
takeDmg(this,Amount,Type,Vector(Force[1],Force[2],Force[3]),Attacker, Inflictor)
takeDmg(this, self.player, Amount, Type, Vector(Force[1],Force[2],Force[3]),Attacker, Inflictor)
end

e2function void entity:takeDamage(number Amount, entity Attacker, entity Inflictor)
Expand Down
14 changes: 10 additions & 4 deletions lua/entities/gmod_wire_expression2/core/custom/player.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
-- made by [G-moder]FertNoN
-- edit by Zimon4eR (TheSlyFox)
-- edit by Zimon4eR

__e2setcost(100)
__e2setcost(200)
e2function void entity:setWeaponColor(vector rgb) -- Zimon4eR
if !IsValid(this) then return end
if !this:IsPlayer() then return end
if !isOwner(self, this) then return end
local Vec = Vector(0,0,0)
rgb[1] = tostring(rgb[1]) != "nan" and rgb[1] or 0
Vec[1] = math.Clamp(rgb[1],0,255)/255
rgb[2] = tostring(rgb[2]) != "nan" and rgb[2] or 0
Vec[2] = math.Clamp(rgb[2],0,255)/255
rgb[3] = tostring(rgb[3]) != "nan" and rgb[3] or 0
Vec[3] = math.Clamp(rgb[3],0,255)/255
this:SetWeaponColor(Vec)
end
Expand All @@ -18,8 +21,11 @@ e2function void entity:setPlayerColor(vector rgb) -- Zimon4eR
if !this:IsPlayer() then return end
if !isOwner(self, this) then return end
local Vec = Vector(0,0,0)
rgb[1] = tostring(rgb[1]) != "nan" and rgb[1] or 0
Vec[1] = math.Clamp(rgb[1],0,255)/255
rgb[2] = tostring(rgb[2]) != "nan" and rgb[2] or 0
Vec[2] = math.Clamp(rgb[2],0,255)/255
rgb[3] = tostring(rgb[3]) != "nan" and rgb[3] or 0
Vec[3] = math.Clamp(rgb[3],0,255)/255
this:SetPlayerColor(Vec)
end
Expand Down Expand Up @@ -55,7 +61,7 @@ end
e2function number entity:hasGodMode()
if !IsValid(this) then return 0 end
if !this:IsPlayer() then return 0 end
return tonumber(this:HasGodMode())
return this:HasGodMode() and 1 or 0
end

e2function void entity:playerRemove()
Expand Down Expand Up @@ -87,7 +93,7 @@ end
e2function number entity:playerIsRagdoll()
if !IsValid(this) then return 0 end
if !this:IsPlayer() then return 0 end
if IsValid(this.ragdoll) then return 1 else return 0 end
return IsValid(this.ragdoll) ? 1 or 0
end

__e2setcost(100)
Expand Down
11 changes: 10 additions & 1 deletion lua/entities/gmod_wire_expression2/core/custom/sound.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- made by [G-moder]FertNoN
-- modified by [AI]Ubi
-- modified by [AI]Ubi & Zimon4eR

util.AddNetworkString('E2SoundSendURL')

Expand Down Expand Up @@ -235,3 +235,12 @@ e2function void soundPlayWorld(string path,vector pos,distance,pitch,volume)
distance=math.Clamp(distance,20,140)
sound.Play(path,Vector(pos[1],pos[2],pos[3]),distance,pitch,volume)
end

__e2setcost(5)

e2function void entity:soundPlaySingle(string path, number volume, number pitch)
if !IsValid(this) then return end
local path=path:Trim()
if string.find(path:lower(),"loop",1,true) then return end
this:EmitSound(path, 75, math.Clamp(pitch,0,255), math.Clamp(volume,0,127)/127, CHAN_AUTO)
end

0 comments on commit b52cdec

Please sign in to comment.