propDissolve function (#3241)

* propDissolve function

* Better descriptions
This commit is contained in:
Astralcircle 2025-01-25 05:03:37 +03:00 committed by GitHub
parent a818821ed9
commit f30caf38a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View File

@ -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"

View File

@ -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)
@ -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