36const float MAX_STORAGE_ATTACHMENTS = 16;
123 _setmodel(e, e.model);
137 e.old_solid = e.solid;
138 e.old_movetype = e.move_movetype;
143 setattachment(e,
parent, s);
153 vector org = gettaginfo(it, 0);
154 setattachment(it, NULL,
"");
159 it.angles = e.angles;
161 it.solid = it.old_solid;
162 set_movetype(it, it.old_movetype);
163 it.takedamage = DAMAGE_AIM;
174 e.damageforcescale = 1;
192 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!");
196 e.message =
strzone(strftime(
true,
"%d-%m-%Y %H:%M:%S"));
197 e.message2 =
strzone(strftime(
true,
"%d-%m-%Y %H:%M:%S"));
240 int slot, physics, solidity;
245 physics = it.move_movetype;
247 else if(it.owner == e)
251 solidity = it.old_solid;
252 physics = it.old_movetype;
253 gettaginfo(it.owner, it.tag_index);
263 port_string[slot] = strcat(port_string[slot],
"\"", gettaginfo_name,
"\" ");
265 port_string[slot] = strcat(port_string[slot],
"\"\" ");
272 port_string[slot] = strcat(port_string[slot], sprintf(
"\"%.9v\"", it.origin),
" ");
273 port_string[slot] = strcat(port_string[slot], sprintf(
"\"%.9v\"", it.angles),
" ");
306 for(
int j = 0; j <= MAX_STORAGE_ATTACHMENTS; ++j)
325 for(i = 0; i < n; ++i)
329 for(i = 0; i < n; ++i)
331 #define SANDBOX_GETARG arg = argv(++argv_num);
383 for(i = 0; i <= MAX_STORAGE_ATTACHMENTS; ++i)
406 fputs(file_get, strcat(sandbox_ObjectPort_Save(it, true),
"\n"));
414 string file_read, file_name;
422 LOG_INFO(
"^3SANDBOX - SERVER: ^7could not find storage file ^3", file_name,
"^7, no objects were loaded");
429 file_read =
fgets(file_get);
442 for (i = 1; i <= 5; ++i)
447 LOG_INFO(
"^3SANDBOX - SERVER: ^7successfully loaded storage file ^3", file_name);
465 print_to(player,
"^2SANDBOX - INFO: ^7Sandbox mode is active, but in read-only mode. Sandbox commands cannot be used");
470 print_to(player,
"^2SANDBOX - INFO: ^7Sandbox mode is active. For usage information, type 'sandbox help'");
482 print_to(player,
"You can use the following sandbox commands:");
483 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");
484 print_to(player,
"^7\"^2object_remove^7\" removes the object the player is looking at. Players can only remove their own objects");
485 print_to(player,
"^7\"^2object_duplicate ^3value^7\" duplicates the object, if the player has copying rights over the original");
486 print_to(player,
"^3copy value ^7- copies the properties of the object to the specified client cvar");
487 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\"");
488 print_to(player,
"^7\"^2object_attach ^3property value^7\" attaches one object to another. Players can only attach their own objects");
489 print_to(player,
"^3get ^7- selects the object you are facing as the object to be attached");
490 print_to(player,
"^3set value ^7- attaches the previously selected object to the object you are facing, on the specified bone");
491 print_to(player,
"^3remove ^7- detaches all objects from the object you are facing");
492 print_to(player,
"^7\"^2object_edit ^3property value^7\" edits the given property of the object. Players can only edit their own objects");
493 print_to(player,
"^3skin value ^7- changes the skin of the object");
494 print_to(player,
"^3alpha value ^7- sets object transparency");
495 print_to(player,
"^3colormod \"value_x value_y value_z\" ^7- main object color");
496 print_to(player,
"^3glowmod \"value_x value_y value_z\" ^7- glow object color");
497 print_to(player,
"^3frame value ^7- object animation frame, for self-animated models");
498 print_to(player,
"^3scale value ^7- changes object scale. 0.5 is half size and 2 is double size");
499 print_to(player,
"^3solidity value ^7- object collisions, 0 = non-solid, 1 = solid");
500 print_to(player,
"^3physics value ^7- object physics, 0 = static, 1 = movable, 2 = physical");
501 print_to(player,
"^3force value ^7- amount of force applied to objects that are shot");
502 print_to(player,
"^3material value ^7- sets the material of the object. Default materials are: metal, stone, wood, flesh");
503 print_to(player,
"^7\"^2object_claim^7\" sets the player as the owner of the object, if they have the right to edit it");
504 print_to(player,
"^7\"^2object_info ^3value^7\" shows public information about the object");
505 print_to(player,
"^3object ^7- prints general information about the object, such as owner and creation / editing date");
506 print_to(player,
"^3mesh ^7- prints information about the object's mesh, including skeletal bones");
507 print_to(player,
"^3attachments ^7- prints information about the object's attachments");
508 print_to(player,
"^7The ^1drag object ^7key can be used to grab and carry objects. Players can only grab their own objects");
513 if(
time < player.object_flood)
515 print_to(player,
strcat(
"^1SANDBOX - WARNING: ^7Flood protection active. Please wait ^3",
ftos(player.object_flood -
time),
" ^7seconds beofore spawning another object"));
526 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");
531 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");
536 precache_model(
argv(2));
537 _setmodel(e,
argv(2));
540 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" spawned an object at origin ^3",
vtos(e.origin));
544 case "object_remove":
549 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" removed an object at origin ^3",
vtos(e.origin));
554 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be removed. Make sure you are facing an object that you have edit rights over");
558 case "object_duplicate":
567 s = strreplace(
"\"",
"\\\"", s);
570 print_to(player,
"^2SANDBOX - INFO: ^7Object copied to clipboard");
573 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be copied. Make sure you are facing an object that you have copy rights over");
578 if(
time < player.object_flood)
580 print_to(player,
strcat(
"^1SANDBOX - WARNING: ^7Flood protection active. Please wait ^3",
ftos(player.object_flood -
time),
" ^7seconds beofore spawning another object"));
586 print_to(player,
"^1SANDBOX - WARNING: ^7No object in clipboard. You must copy an object before you can paste it");
596 print_to(player,
"^2SANDBOX - INFO: ^7Object pasted successfully");
598 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" pasted an object at origin ^3",
vtos(e.origin));
604 case "object_attach":
612 player.object_attach = e;
613 print_to(player,
"^2SANDBOX - INFO: ^7Object selected for attachment");
616 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");
619 if(player.object_attach ==
NULL)
621 print_to(player,
"^1SANDBOX - WARNING: ^7No object selected for attachment. Please select an object to be attached first.");
630 player.object_attach =
NULL;
631 print_to(player,
"^2SANDBOX - INFO: ^7Object attached successfully");
633 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" attached objects at origin ^3",
vtos(e.origin));
636 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");
644 print_to(player,
"^2SANDBOX - INFO: ^7Child objects detached successfully");
646 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" detached objects at origin ^3",
vtos(e.origin));
649 print_to(player,
"^1SANDBOX - WARNING: ^7Child objects could not be detached. Make sure you are facing an object that you have edit rights over");
658 print_to(player,
"^1SANDBOX - WARNING: ^7Too few parameters. You must specify a property to edit");
720 for (j = 1; j <= 5; ++j)
728 print_to(player,
"^1SANDBOX - WARNING: ^7Invalid object property. For usage information, type 'sandbox help'");
733 strcpy(e.message2, strftime(
true,
"%d-%m-%Y %H:%M:%S"));
736 LOG_INFO(
"^3SANDBOX - SERVER: ^7", player.netname,
" edited property ^3",
argv(2),
" ^7of an object at origin ^3",
vtos(e.origin));
740 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be edited. Make sure you are facing an object that you have edit rights over");
746 if(player.crypto_idfp ==
"")
748 print_to(player,
"^1SANDBOX - WARNING: ^7You do not have a player UID, and cannot claim objects");
757 if(e.netname != player.netname)
759 strcpy(e.netname, player.netname);
760 print_to(player,
"^2SANDBOX - INFO: ^7Object owner name updated");
763 if(e.crypto_idfp == player.crypto_idfp)
765 print_to(player,
"^2SANDBOX - INFO: ^7Object is already yours, nothing to claim");
769 strcpy(e.crypto_idfp, player.crypto_idfp);
771 print_to(player,
"^2SANDBOX - INFO: ^7Object claimed successfully");
773 print_to(player,
"^1SANDBOX - WARNING: ^7Object could not be claimed. Make sure you are facing an object that you have edit rights over");
785 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\""));
791 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));
800 gettaginfo(e, it.tag_index);
801 s = strcat(s,
"^1attachment ", ftos(j),
"^7 has mesh \"^3", it.model,
"^7\" at animation frame ^3", ftos(it.frame));
802 s = strcat(s,
"^7 and is attached to bone \"^5", gettaginfo_name,
"^7\", ");
805 print_to(player,
strcat(
"^2SANDBOX - INFO: ^7Object contains the following ^1",
ftos(j),
"^7 attachment(s): ", s));
807 print_to(player,
"^2SANDBOX - INFO: ^7Object contains no attachments");
811 print_to(player,
"^1SANDBOX - WARNING: ^7No information could be found. Make sure you are facing an object");
816 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)