36const float MAX_STORAGE_ATTACHMENTS = 16;
124 _setmodel(e, e.model);
138 e.old_solid = e.solid;
139 e.old_movetype = e.move_movetype;
144 setattachment(e,
parent, s);
154 vector org = gettaginfo(it, 0);
155 setattachment(it, NULL,
"");
160 it.angles = e.angles;
162 it.solid = it.old_solid;
163 set_movetype(it, it.old_movetype);
164 it.takedamage = DAMAGE_AIM;
175 e.damageforcescale = 1;
193 print_to(
this,
"^1SANDBOX - WARNING: ^7You spawned an object, but lack a player UID. ^1Your objects are not secured and can be edited by any player!");
197 e.message =
strzone(strftime(
true,
"%d-%m-%Y %H:%M:%S"));
198 e.message2 =
strzone(strftime(
true,
"%d-%m-%Y %H:%M:%S"));
241 int slot, physics, solidity;
246 physics = it.move_movetype;
248 else if(it.owner == e)
252 solidity = it.old_solid;
253 physics = it.old_movetype;
254 gettaginfo(it.owner, it.tag_index);
264 port_string[slot] = strcat(port_string[slot],
"\"", gettaginfo_name,
"\" ");
266 port_string[slot] = strcat(port_string[slot],
"\"\" ");
273 port_string[slot] = strcat(port_string[slot], sprintf(
"\"%.9v\"", it.origin),
" ");
274 port_string[slot] = strcat(port_string[slot], sprintf(
"\"%.9v\"", it.angles),
" ");
307 for(
int j = 0; j <= MAX_STORAGE_ATTACHMENTS; ++j)
326 for(i = 0; i < n; ++i)
330 for(i = 0; i < n; ++i)
332 #define SANDBOX_GETARG arg = argv(++argv_num);
384 for(i = 0; i <= MAX_STORAGE_ATTACHMENTS; ++i)
407 fputs(file_get, strcat(sandbox_ObjectPort_Save(it, true),
"\n"));
415 string file_read, file_name;
423 LOG_INFO(
"^3SANDBOX - SERVER: ^7could not find storage file ^3", file_name,
"^7, no objects were loaded");
430 file_read =
fgets(file_get);
444 for (i = 1; i <= 5; ++i)
449 LOG_INFO(
"^3SANDBOX - SERVER: ^7successfully loaded storage file ^3", file_name);
467 print_to(player,
"^2SANDBOX - INFO: ^7Sandbox mode is active, but in read-only mode. Sandbox commands cannot be used");
472 print_to(player,
"^2SANDBOX - INFO: ^7Sandbox mode is active. For usage information, type 'sandbox help'");
484 print_to(player,
"You can use the following sandbox commands:");
485 print_to(player,
"^7\"^2object_spawn ^3models/foo/bar.md3^7\" spawns a new object in front of the player, and gives it the specified model");
486 print_to(player,
"^7\"^2object_remove^7\" removes the object the player is looking at. Players can only remove their own objects");
487 print_to(player,
"^7\"^2object_duplicate ^3value^7\" duplicates the object, if the player has copying rights over the original");
488 print_to(player,
"^3copy value ^7- copies the properties of the object to the specified client cvar");
489 print_to(player,
"^3paste value ^7- spawns an object with the given properties. Properties or cvars must be specified as follows; eg1: \"0 1 2 ...\", eg2: \"$cl_cvar\"");
490 print_to(player,
"^7\"^2object_attach ^3property value^7\" attaches one object to another. Players can only attach their own objects");
491 print_to(player,
"^3get ^7- selects the object you are facing as the object to be attached");
492 print_to(player,
"^3set value ^7- attaches the previously selected object to the object you are facing, on the specified bone");
493 print_to(player,
"^3remove ^7- detaches all objects from the object you are facing");
494 print_to(player,
"^7\"^2object_edit ^3property value^7\" edits the given property of the object. Players can only edit their own objects");
495 print_to(player,
"^3skin value ^7- changes the skin of the object");
496 print_to(player,
"^3alpha value ^7- sets object transparency");
497 print_to(player,
"^3colormod \"value_x value_y value_z\" ^7- main object color");
498 print_to(player,
"^3glowmod \"value_x value_y value_z\" ^7- glow object color");
499 print_to(player,
"^3frame value ^7- object animation frame, for self-animated models");
500 print_to(player,
"^3scale value ^7- changes object scale. 0.5 is half size and 2 is double size");
501 print_to(player,
"^3solidity value ^7- object collisions, 0 = non-solid, 1 = solid");
502 print_to(player,
"^3physics value ^7- object physics, 0 = static, 1 = movable, 2 = physical");
503 print_to(player,
"^3force value ^7- amount of force applied to objects that are shot");
504 print_to(player,
"^3material value ^7- sets the material of the object. Default materials are: metal, stone, wood, flesh");
505 print_to(player,
"^7\"^2object_claim^7\" sets the player as the owner of the object, if they have the right to edit it");
506 print_to(player,
"^7\"^2object_info ^3value^7\" shows public information about the object");
507 print_to(player,
"^3object ^7- prints general information about the object, such as owner and creation / editing date");
508 print_to(player,
"^3mesh ^7- prints information about the object's mesh, including skeletal bones");
509 print_to(player,
"^3attachments ^7- prints information about the object's attachments");
510 print_to(player,
"^7The ^1drag object ^7key can be used to grab and carry objects. Players can only grab their own objects");
515 if(
time < player.object_flood)
517 print_to(player,
strcat(
"^1SANDBOX - WARNING: ^7Flood protection active. Please wait ^3",
ftos(player.object_flood -
time),
" ^7seconds beofore spawning another object"));
528 print_to(player,
"^1SANDBOX - WARNING: ^7Attempted to spawn an object without specifying a model. Please specify the path to your model file after the 'object_spawn' command");
533 print_to(player,
"^1SANDBOX - WARNING: ^7Attempted to spawn an object with a non-existent model. Make sure the path to your model file is correct");
538 precache_model(
argv(2));
539 _setmodel(e,
argv(2));
542 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" spawned an object at origin ^3",
vtos(e.origin));
546 case "object_remove":
551 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" removed an object at origin ^3",
vtos(e.origin));
556 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be removed. Make sure you are facing an object that you have edit rights over");
560 case "object_duplicate":
569 s = strreplace(
"\"",
"\\\"", s);
572 print_to(player,
"^2SANDBOX - INFO: ^7Object copied to clipboard");
575 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be copied. Make sure you are facing an object that you have copy rights over");
580 if(
time < player.object_flood)
582 print_to(player,
strcat(
"^1SANDBOX - WARNING: ^7Flood protection active. Please wait ^3",
ftos(player.object_flood -
time),
" ^7seconds beofore spawning another object"));
588 print_to(player,
"^1SANDBOX - WARNING: ^7No object in clipboard. You must copy an object before you can paste it");
598 print_to(player,
"^2SANDBOX - INFO: ^7Object pasted successfully");
600 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" pasted an object at origin ^3",
vtos(e.origin));
606 case "object_attach":
614 player.object_attach = e;
615 print_to(player,
"^2SANDBOX - INFO: ^7Object selected for attachment");
618 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be selected for attachment. Make sure you are facing an object that you have edit rights over");
621 if(player.object_attach ==
NULL)
623 print_to(player,
"^1SANDBOX - WARNING: ^7No object selected for attachment. Please select an object to be attached first.");
632 player.object_attach =
NULL;
633 print_to(player,
"^2SANDBOX - INFO: ^7Object attached successfully");
635 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" attached objects at origin ^3",
vtos(e.origin));
638 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be attached to the parent. Make sure you are facing an object that you have edit rights over");
646 print_to(player,
"^2SANDBOX - INFO: ^7Child objects detached successfully");
648 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" detached objects at origin ^3",
vtos(e.origin));
651 print_to(player,
"^1SANDBOX - WARNING: ^7Child objects could not be detached. Make sure you are facing an object that you have edit rights over");
660 print_to(player,
"^1SANDBOX - WARNING: ^7Too few parameters. You must specify a property to edit");
722 for (j = 1; j <= 5; ++j)
730 print_to(player,
"^1SANDBOX - WARNING: ^7Invalid object property. For usage information, type 'sandbox help'");
735 strcpy(e.message2, strftime(
true,
"%d-%m-%Y %H:%M:%S"));
738 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" edited property ^3",
argv(2),
" ^7of an object at origin ^3",
vtos(e.origin));
742 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be edited. Make sure you are facing an object that you have edit rights over");
748 if(player.crypto_idfp ==
"")
750 print_to(player,
"^1SANDBOX - WARNING: ^7You do not have a player UID, and cannot claim objects");
759 if(e.netname != player.netname)
761 strcpy(e.netname, player.netname);
762 print_to(player,
"^2SANDBOX - INFO: ^7Object owner name updated");
765 if(e.crypto_idfp == player.crypto_idfp)
767 print_to(player,
"^2SANDBOX - INFO: ^7Object is already yours, nothing to claim");
771 strcpy(e.crypto_idfp, player.crypto_idfp);
773 print_to(player,
"^2SANDBOX - INFO: ^7Object claimed successfully");
775 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be claimed. Make sure you are facing an object that you have edit rights over");
787 print_to(player,
strcat(
"^2SANDBOX - INFO: ^7Object is owned by \"^7", e.netname,
"^7\", created \"^3", e.message,
"^7\", last edited \"^3", e.message2,
"^7\""));
793 print_to(player,
strcat(
"^2SANDBOX - INFO: ^7Object mesh is \"^3", e.model,
"^7\" at animation frame ^3",
ftos(e.frame),
" ^7containing the following tags: ", s));
802 gettaginfo(e, it.tag_index);
803 s = strcat(s,
"^1attachment ", ftos(j),
"^7 has mesh \"^3", it.model,
"^7\" at animation frame ^3", ftos(it.frame));
804 s = strcat(s,
"^7 and is attached to bone \"^5", gettaginfo_name,
"^7\", ");
807 print_to(player,
strcat(
"^2SANDBOX - INFO: ^7Object contains the following ^1",
ftos(j),
"^7 attachment(s): ", s));
809 print_to(player,
"^2SANDBOX - INFO: ^7Object contains no attachments");
813 print_to(player,
"^1SANDBOX - WARNING: ^7No information could be found. Make sure you are facing an object");
818 print_to(player,
"Invalid command. For usage information, type 'sandbox help'");
#define MUTATOR_CALLHOOK(id,...)
#define REGISTER_MUTATOR(...)
#define MUTATOR_HOOKFUNCTION(...)
#define MUTATOR_RETURNVALUE
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
const float SOLID_TRIGGER
#define CSQCMODEL_AUTOUPDATE(e)
#define CSQCMODEL_AUTOINIT(e)
ERASEABLE bool expr_evaluate(string s)
Evaluate an expression of the form: [+ | -]?
#define tokenizebyseparator
void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
ERASEABLE bool fexists(string f)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
#define SV_ParseClientCommand
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
void set_movetype(entity this, int mt)
const int MOVETYPE_FOLLOW
const int MOVETYPE_PHYSICS
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void print_to(entity to, string input)
#define _sound(e, c, s, v, a)
void sandbox_ObjectRemove(entity e)
bool autocvar_g_sandbox_readonly
entity sandbox_ObjectSpawn(entity this, float database)
float autocvar_g_sandbox_editor_flood
entity sandbox_ObjectEdit_Get(entity this, float permissions)
string sandbox_ObjectPort_Save(entity e, bool database)
float autocvar_g_sandbox_object_material_velocity_min
void sandbox_ObjectAttach_Remove(entity e)
void sandbox_ObjectEdit_Scale(entity e, float f)
float autocvar_g_sandbox_object_scale_max
string port_string[MAX_STORAGE_ATTACHMENTS]
string autocvar_g_sandbox_storage_name
IntrusiveList g_sandbox_objects
void sandbox_Database_Save()
entity sandbox_ObjectPort_Load(entity this, string s, float database)
void sandbox_ObjectFunction_Think(entity this)
float autocvar_g_sandbox_object_scale_min
int autocvar_g_sandbox_info
float autocvar_g_sandbox_storage_autosave
float autocvar_g_sandbox_editor_distance_spawn
float autocvar_g_sandbox_editor_distance_edit
void sandbox_ObjectFunction_Touch(entity this, entity toucher)
int autocvar_g_sandbox_editor_maxobjects
string autocvar_g_sandbox
void sandbox_Database_Load()
int autocvar_g_sandbox_editor_free
float autocvar_g_sandbox_object_material_velocity_factor
void sandbox_ObjectAttach_Set(entity e, entity parent, string s)
bool autocvar_g_sandbox_storage_autoload
void crosshair_trace_plusvisibletriggers(entity pl)
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
ERASEABLE vector RoundPerfectVector(vector v)