Skip to content

Commit

Permalink
Merge pull request #1780 from thegrb93/material-modifiers
Browse files Browse the repository at this point in the history
Add entity modifiers for e2 material setting
  • Loading branch information
thegrb93 authored Nov 25, 2018
2 parents 14ea40f + 54712f2 commit 4a9c97f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/entities/gmod_wire_expression2/core/e2lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ E2Lib.setPos = WireLib.setPos
E2Lib.setAng = WireLib.setAng

function E2Lib.setMaterial(ent, material)
ent:SetMaterial(WireLib.IsValidMaterial(material))
material = WireLib.IsValidMaterial(material)
ent:SetMaterial(material)
duplicator.StoreEntityModifier(ent, "material", { MaterialOverride = material })
end

function E2Lib.setSubMaterial(ent, index, material)
ent:SetSubMaterial(index,WireLib.IsValidMaterial(material))
index = math.Clamp(index, 0, 255)
material = WireLib.IsValidMaterial(material)
ent:SetSubMaterial(index, material)
duplicator.StoreEntityModifier(ent, "submaterial", { ["SubMaterialOverride_"..index] = material })
end

-- getHash
Expand Down

0 comments on commit 4a9c97f

Please sign in to comment.