Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

propDissolve function #3241

Merged
merged 2 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading