Skip to content

Commit

Permalink
propDissolve function (#3241)
Browse files Browse the repository at this point in the history
* propDissolve function

* Better descriptions
  • Loading branch information
Astralcircle authored Jan 25, 2025
1 parent a818821 commit f30caf3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lua/entities/gmod_wire_expression2/core/custom/cl_prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ E2Helper.Descriptions["parentTo(e:)"] = E2Helper.Descriptions["parentTo(e:e)"]
E2Helper.Descriptions["parentToAttachment(e:es)"] = "Parents one entity to anothers attachment."
E2Helper.Descriptions["deparent(e:)"] = "Unparents an entity, so it moves freely again."
E2Helper.Descriptions["propBreak(e:)"] = "Breaks/Explodes breakable/explodable props (Useful for Mines)."
E2Helper.Descriptions["propDissolve(e:)"] = "Dissolves the specified entity."
E2Helper.Descriptions["propDissolve(e:n)"] = "Dissolves the specified entity using the given dissolve type (_ENTITY_DISSOLVE)."
E2Helper.Descriptions["propDissolve(e:nn)"] = "Dissolves the specified entity with the given dissolve type (_ENTITY_DISSOLVE) and magnitude."
E2Helper.Descriptions["propCanCreate()"] = "Returns 1 when propSpawn() will successfully spawn a prop until the limit is reached."
E2Helper.Descriptions["propDrag(e:n)"] = "Passing 0 makes the entity not be affected by drag"
E2Helper.Descriptions["propInertia(e:n)"] = "Sets the directional inertia"
Expand Down
22 changes: 21 additions & 1 deletion lua/entities/gmod_wire_expression2/core/custom/prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ local ValidSpawn = PropCore.ValidSpawn
local canHaveInvalidPhysics = {
delete=true, parent=true, deparent=true, solid=true,
shadow=true, draw=true, use=true, pos=true, ang=true,
manipulate=true, noDupe=true
manipulate=true, noDupe=true, dissolve=true
}

function PropCore.ValidAction(self, entity, cmd, bone)
Expand Down Expand Up @@ -714,6 +714,26 @@ e2function void entity:propBreak()
this:Fire("break",1,0)
end

E2Lib.registerConstant("ENTITY_DISSOLVE_NORMAL", 0)
E2Lib.registerConstant("ENTITY_DISSOLVE_ELECTRICAL", 1)
E2Lib.registerConstant("ENTITY_DISSOLVE_ELECTRICAL_LIGHT", 2)
E2Lib.registerConstant("ENTITY_DISSOLVE_CORE", 3)

e2function void entity:propDissolve()
if not ValidAction(self, this, "dissolve") then return end
this:Dissolve()
end

e2function void entity:propDissolve(number dissolvetype)
if not ValidAction(self, this, "dissolve") then return end
this:Dissolve(dissolvetype)
end

e2function void entity:propDissolve(number dissolvetype, number magnitude)
if not ValidAction(self, this, "dissolve") then return end
this:Dissolve(dissolvetype, magnitude)
end

e2function void entity:use()
if not ValidAction(self, this, "use") then return end

Expand Down

0 comments on commit f30caf3

Please sign in to comment.