Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
98 changes: 68 additions & 30 deletions addons/amxmodx/scripting/include/box_with_boxes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,90 @@
#pragma library box_with_boxes
#endif

/*
* TODO
*/
/**
* Creates a box of the specified type with the specified origin, minimums, and maximums.
*
* @param type The type of the box.
* @param origin The origin of the box.
* @param mins The minimums of the box.
* @param maxs The maximums of the box.
*/
native bwb_create_box(const type[], Float:origin[3], Float:mins[3], Float:maxs[3]);

/*
* TODO
*/
/**
* Registers a box type with the specified type and color.
*
* @param type The type of the box.
* @param color The color of the box.
*/
native bwb_register_box_type(const type[], color[3] = {255, 255, 255});

/*
* TODO
*/
/**
* Gets the index of the specified box type.
*
* @param type The type of the box.
*
* @return The index of the box type.
*/
native bwb_get_type_index(const type[]);

/*
* TODO
*/
/**
* Gets the type of the specified box.
*
* @param box The index of the box.
* @param type The type of the box.
Comment thread
Nord1cWarr1or marked this conversation as resolved.
Outdated
* @param len The length of the type of the box.
Comment thread
Nord1cWarr1or marked this conversation as resolved.
Outdated
*/
native bwb_get_box_type(box, type[], len);

/*
* TODO
*/
/**
* Called when an entity starts touching a box.
*
* @param box The index of the box.
* @param ent The entity that is touching the box.
* @param type_index The index of the box type.
*/
forward bwb_box_start_touch(box, ent, type_index);

/*
* TODO
*/
/**
* Called when an entity stops touching a box.
*
* @param box The index of the box.
* @param ent The entity that stopped touching the box.
* @param type_index The index of the box type.
*/
forward bwb_box_stop_touch(box, ent, type_index);

/*
* TODO
*/
/**
* Called when an entity touches a box.
*
* @param box The index of the box.
* @param ent The entity that is touching the box.
* @param type_index The index of the box type.
*/
forward bwb_box_touch(box, ent, type_index);

/*
* TODO
*/
/**
* Called when an entity invalidly touches a box.
Comment thread
Nord1cWarr1or marked this conversation as resolved.
Outdated
*
* @param box The index of the box.
* @param ent The entity that invalidly touched the box.
Comment thread
Nord1cWarr1or marked this conversation as resolved.
Outdated
* @param type_index The index of the box type.
*/
forward bwb_box_invalid_touch(box, ent, type_index);

/*
* TODO
*/
/**
* Called when a box is created.
*
* @param box The index of the box.
* @param type The type of the box.
*/
forward bwb_box_created(box, const type[]);

/*
* TODO
*/
/**
* Called when a box is deleted.
*
* @param box The index of the box.
* @param type The type of the box.
*/
forward bwb_box_deleted(box, const type[]);
26 changes: 26 additions & 0 deletions addons/amxmodx/scripting/include/box_with_boxes_stocks.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
#endif
#define _box_with_boxes_stocks_included

/**
* Determines if two entities intersect.
*
* @param a The first entity.
* @param b The second entity.
*
* @return True if the entities intersect, false otherwise.
*/
stock intersect(a, b) {
new Float:amins[3], Float:amaxs[3];
pev(a, pev_absmin, amins);
Expand All @@ -16,6 +24,16 @@ stock intersect(a, b) {
(amins[2] <= bmaxs[2] && amaxs[2] >= bmins[2]);
}

/**
* Calculates the distance between two boxes.
*
* @param mins1 The minimums of the first box.
* @param maxs1 The maximums of the first box.
* @param mins2 The minimums of the second box.
* @param maxs2 The maximums of the second box.
*
* @return The distance between the two boxes.
*/
stock Float:fm_boxes_distance(const Float:mins1[3], const Float:maxs1[3], const Float:mins2[3], const Float:maxs2[3]) {
new Float:dist[3];
for (new i = 0; i < 3; ++i) {
Expand All @@ -28,6 +46,14 @@ stock Float:fm_boxes_distance(const Float:mins1[3], const Float:maxs1[3], const
return vector_length(dist);
}

/**
* Calculates the distance between two box entities.
*
* @param boxent1 The first box entity.
* @param boxent2 The second box entity.
*
* @return The distance between the two box entities.
*/
stock Float:fm_boxents_distance(boxent1, boxent2) {
new Float:mins1[3], Float:maxs1[3];
pev(boxent1, pev_absmin, mins1);
Expand Down