Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "pointcontents"
From Quake Wiki
(Initial draft.) |
|||
Line 1: | Line 1: | ||
− | + | ''float'' '''pointcontents'''(''vector'' pos) | |
− | |||
− | + | == Usage == | |
+ | Gets what kind of contents exist at the given point. Only the world is taken into account for this, entities like monsters are ignored. | ||
− | + | === Parameters === | |
− | : | + | *''pos'' |
− | + | :The position to get the contents from. | |
− | |||
+ | === Return === | ||
+ | One of the following: | ||
+ | *<code>CONTENT_EMPTY</code> | ||
+ | :Not inside anything. | ||
+ | *<code>CONTENT_SOLID</code> | ||
+ | :Inside of solid level geometry. | ||
+ | *<code>CONTENT_WATER</code> | ||
+ | :Inside of water. | ||
+ | *<code>CONTENT_SLIME</code> | ||
+ | :Inside of slime. | ||
+ | *<code>CONTENT_LAVA</code> | ||
+ | :Inside of lava. | ||
+ | *<code>CONTENT_SKY</code> | ||
+ | :Inside the sky. | ||
+ | |||
+ | == Example == | ||
+ | // If there's something at the given location, this function won't place the entity there | ||
+ | float CheckMove(vector pos) | ||
+ | { | ||
+ | float contents = pointcontents(pos); | ||
+ | if (contents != CONTENT_EMPTY) | ||
+ | return FALSE; | ||
+ | |||
+ | setorigin(self, pos); | ||
+ | return TRUE; | ||
+ | } | ||
[[Category:QuakeC Function]] | [[Category:QuakeC Function]] |
Latest revision as of 13:01, 1 August 2023
float pointcontents(vector pos)
Contents
Usage[edit]
Gets what kind of contents exist at the given point. Only the world is taken into account for this, entities like monsters are ignored.
Parameters[edit]
- pos
- The position to get the contents from.
Return[edit]
One of the following:
CONTENT_EMPTY
- Not inside anything.
CONTENT_SOLID
- Inside of solid level geometry.
CONTENT_WATER
- Inside of water.
CONTENT_SLIME
- Inside of slime.
CONTENT_LAVA
- Inside of lava.
CONTENT_SKY
- Inside the sky.
Example[edit]
// If there's something at the given location, this function won't place the entity there float CheckMove(vector pos) { float contents = pointcontents(pos); if (contents != CONTENT_EMPTY) return FALSE; setorigin(self, pos); return TRUE; }