-int redflag_prevframe, blueflag_prevframe, yellowflag_prevframe, pinkflag_prevframe, neutralflag_prevframe; // status during previous frame
-int redflag_prevstatus, blueflag_prevstatus, yellowflag_prevstatus, pinkflag_prevstatus, neutralflag_prevstatus; // last remembered status
-float redflag_statuschange_time, blueflag_statuschange_time, yellowflag_statuschange_time, pinkflag_statuschange_time, neutralflag_statuschange_time; // time when the status changed
- int redflag, blueflag, yellowflag, pinkflag, neutralflag; // current status
- float redflag_statuschange_elapsedtime, blueflag_statuschange_elapsedtime, yellowflag_statuschange_elapsedtime, pinkflag_statuschange_elapsedtime, neutralflag_statuschange_elapsedtime; // time since the status changed
- drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL);
- frametimeavg = (frametimeavg + frametimeavg1 + frametimeavg2 + currentframetime)/4; // average three frametimes into framecounter for slightly more stable fps readings :P
- if(currentframetime > 0.0001) // filter out insane values which sometimes seem to occur and throw off the average? If you are getting 10,000 fps or more, then you don't need a framerate counter.
- {
- if(fabs(prevfps - (1/frametimeavg)) > prevfps * cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold")) // if there was a big jump in fps, just force prevfps at current (1/currentframetime) to make big updates instant
- prevfps = (1/currentframetime);
- prevfps = (1 - weight) * prevfps + weight * (1/frametimeavg); // framecounter just used so there's no need for a new variable, think of it as "frametime average"
- drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL); \
- o.y += fontsize.y; \
-} while(0)
-void HUD_InfoMessages(void)
-{
- if(!autocvar__hud_configure)
- {
- if(!autocvar_hud_panel_infomessages) return;
- }
-
- HUD_Panel_UpdateCvars();
- vector pos, mySize;
- pos = panel_pos;
- mySize = panel_size;
-
- HUD_Panel_DrawBg(1);
- if(panel_bg_padding)
- {
- pos += '1 1 0' * panel_bg_padding;
- mySize -= '2 2 0' * panel_bg_padding;
- }
-
- // always force 5:1 aspect
- vector newSize = '0 0 0';
- if(mySize.x/mySize.y > 5)
- {
- newSize.x = 5 * mySize.y;
- newSize.y = mySize.y;
-
- pos.x = pos.x + (mySize.x - newSize.x) / 2;
- }
- else
- {
- newSize.y = 1/5 * mySize.x;
- newSize.x = mySize.x;
-
- pos.y = pos.y + (mySize.y - newSize.y) / 2;
- }
-
- mySize = newSize;
- entity tm;
- vector o;
- o = pos;
-
- vector fontsize;
- fontsize = '0.20 0.20 0' * mySize.y;
-
- float a;
- a = panel_fg_alpha;
-
- string s;
- if(!autocvar__hud_configure)
- {
- if(spectatee_status && !intermission)
- {
- a = 1;
- if(spectatee_status == -1)
- s = _("^1Observing");
- else
- s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(current_player));
- drawInfoMessage(s);
-
- if(spectatee_status == -1)
- s = sprintf(_("^1Press ^3%s^1 to spectate"), getcommandkey("primary fire", "+fire"));
- else
- s = sprintf(_("^1Press ^3%s^1 or ^3%s^1 for next or previous player"), getcommandkey("next weapon", "weapnext"), getcommandkey("previous weapon", "weapprev"));
- drawInfoMessage(s);
-
- if(spectatee_status == -1)
- s = sprintf(_("^1Use ^3%s^1 or ^3%s^1 to change the speed"), getcommandkey("next weapon", "weapnext"), getcommandkey("previous weapon", "weapprev"));
- else
- s = sprintf(_("^1Press ^3%s^1 to observe"), getcommandkey("secondary fire", "+fire2"));
- drawInfoMessage(s);
-
- s = sprintf(_("^1Press ^3%s^1 for gamemode info"), getcommandkey("server info", "+show_info"));
- drawInfoMessage(s);
-
- if(gametype == MAPINFO_TYPE_LMS)
- {
- entity sk;
- sk = playerslots[player_localnum];
- if(sk.(scores[ps_primary]) >= 666)
- s = _("^1Match has already begun");
- else if(sk.(scores[ps_primary]) > 0)
- s = _("^1You have no more lives left");
- else
- s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
- }
- else
- s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
- drawInfoMessage(s);
-
- //show restart countdown:
- if (time < getstatf(STAT_GAMESTARTTIME)) {
- float countdown;
- //we need to ceil, otherwise the countdown would be off by .5 when using round()
- a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha, (1 - (g / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passone))), 1); // pass one: all messages after the first have half theAlpha
- a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha, (1 - (g / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passtwo))), 1); // pass two: after that, gradually lower theAlpha even more for each message
- }
- a *= panel_fg_alpha;
-
- // finally set the size based on the new theAlpha from subsequent fading
- if (a > 0.5/255.0) // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
- drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize.y, ts, fontsize, a, DRAWFLAG_NORMAL);
- drawpic('0 0 0', pic, eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * hud_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
- }
-
- // cache the panel order into the panel_order array
-// Get padding. See comments above, it's similar.
-// last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
+ drawpic('0 0 0', pic, eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * hud_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
+ }
+
+ // cache the panel order into the panel_order array
+// Get padding. See comments above, it's similar.
+// last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
+ if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
+ // minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then)
+ a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha, (1 - (g / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passone))), 1); // pass one: all messages after the first have half theAlpha
+ a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha, (1 - (g / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passtwo))), 1); // pass two: after that, gradually lower theAlpha even more for each message
+ }
+ a *= panel_fg_alpha;
+
+ // finally set the size based on the new theAlpha from subsequent fading
+ if (a > 0.5/255.0) // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
+ drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize.y, ts, fontsize, a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL);
+ frametimeavg = (frametimeavg + frametimeavg1 + frametimeavg2 + currentframetime)/4; // average three frametimes into framecounter for slightly more stable fps readings :P
+ if(currentframetime > 0.0001) // filter out insane values which sometimes seem to occur and throw off the average? If you are getting 10,000 fps or more, then you don't need a framerate counter.
+ {
+ if(fabs(prevfps - (1/frametimeavg)) > prevfps * cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold")) // if there was a big jump in fps, just force prevfps at current (1/currentframetime) to make big updates instant
+ prevfps = (1/currentframetime);
+ prevfps = (1 - weight) * prevfps + weight * (1/frametimeavg); // framecounter just used so there's no need for a new variable, think of it as "frametime average"
+ drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL); \
+ o.y += fontsize.y; \
+} while(0)
+void HUD_InfoMessages()
+{
+ if(!autocvar__hud_configure)
+ {
+ if(!autocvar_hud_panel_infomessages) return;
+ }
+
+ HUD_Panel_UpdateCvars();
+ vector pos, mySize;
+ pos = panel_pos;
+ mySize = panel_size;
+
+ HUD_Panel_DrawBg(1);
+ if(panel_bg_padding)
+ {
+ pos += '1 1 0' * panel_bg_padding;
+ mySize -= '2 2 0' * panel_bg_padding;
+ }
+
+ // always force 5:1 aspect
+ vector newSize = '0 0 0';
+ if(mySize.x/mySize.y > 5)
+ {
+ newSize.x = 5 * mySize.y;
+ newSize.y = mySize.y;
+
+ pos.x = pos.x + (mySize.x - newSize.x) / 2;
+ }
+ else
+ {
+ newSize.y = 1/5 * mySize.x;
+ newSize.x = mySize.x;
+
+ pos.y = pos.y + (mySize.y - newSize.y) / 2;
+ }
+
+ mySize = newSize;
+ entity tm;
+ vector o;
+ o = pos;
+
+ vector fontsize;
+ fontsize = '0.20 0.20 0' * mySize.y;
+
+ float a;
+ a = panel_fg_alpha;
+
+ string s;
+ if(!autocvar__hud_configure)
+ {
+ if(spectatee_status && !intermission)
+ {
+ a = 1;
+ if(spectatee_status == -1)
+ s = _("^1Observing");
+ else
+ s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(current_player));
+ drawInfoMessage(s);
+
+ if(spectatee_status == -1)
+ s = sprintf(_("^1Press ^3%s^1 to spectate"), getcommandkey("primary fire", "+fire"));
+ else
+ s = sprintf(_("^1Press ^3%s^1 or ^3%s^1 for next or previous player"), getcommandkey("next weapon", "weapnext"), getcommandkey("previous weapon", "weapprev"));
+ drawInfoMessage(s);
+
+ if(spectatee_status == -1)
+ s = sprintf(_("^1Use ^3%s^1 or ^3%s^1 to change the speed"), getcommandkey("next weapon", "weapnext"), getcommandkey("previous weapon", "weapprev"));
+ else
+ s = sprintf(_("^1Press ^3%s^1 to observe"), getcommandkey("secondary fire", "+fire2"));
+ drawInfoMessage(s);
+
+ s = sprintf(_("^1Press ^3%s^1 for gamemode info"), getcommandkey("server info", "+show_info"));
+ drawInfoMessage(s);
+
+ if(gametype == MAPINFO_TYPE_LMS)
+ {
+ entity sk;
+ sk = playerslots[player_localnum];
+ if(sk.(scores[ps_primary]) >= 666)
+ s = _("^1Match has already begun");
+ else if(sk.(scores[ps_primary]) > 0)
+ s = _("^1You have no more lives left");
+ else
+ s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
+ }
+ else
+ s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
+ drawInfoMessage(s);
+
+ //show restart countdown:
+ if (time < getstatf(STAT_GAMESTARTTIME)) {
+ float countdown;
+ //we need to ceil, otherwise the countdown would be off by .5 when using round()
+int redflag_prevframe, blueflag_prevframe, yellowflag_prevframe, pinkflag_prevframe, neutralflag_prevframe; // status during previous frame
+int redflag_prevstatus, blueflag_prevstatus, yellowflag_prevstatus, pinkflag_prevstatus, neutralflag_prevstatus; // last remembered status
+float redflag_statuschange_time, blueflag_statuschange_time, yellowflag_statuschange_time, pinkflag_statuschange_time, neutralflag_statuschange_time; // time when the status changed
+ int redflag, blueflag, yellowflag, pinkflag, neutralflag; // current status
+ float redflag_statuschange_elapsedtime, blueflag_statuschange_elapsedtime, yellowflag_statuschange_elapsedtime, pinkflag_statuschange_elapsedtime, neutralflag_statuschange_elapsedtime; // time since the status changed
- if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
- // minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then)
// CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided. To execute standard behavior, simply execute localcmd with the string.
+ if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_StuffCmd(\"%s\")\n", strMessage);
localcmd(strMessage);
}
// CSQC_Parse_Print : Provides the print string in the first parameter that the server provided. To execute standard behavior, simply execute print with the string.
+ This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams.
+
+keys:
+"target" - first control point.
+"target2" - second control point.
+ */
+spawnfunc(onslaught_link)
+{
+ if(!g_onslaught) { remove(self); return; }
+
+ if (self.target == "" || self.target2 == "")
+ objerror("target and target2 must be set\n");
+
+ self.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist
-REGISTER_GAMETYPE(_("Race CTS"),cts,g_cts,CTS,false,"","timelimit=20",_("Race for fastest time."));
+REGISTER_GAMETYPE(_("Race CTS"),cts,g_cts,CTS,false,"cloaked","timelimit=20",_("Race for fastest time."));
#define g_cts IS_GAMETYPE(CTS)
REGISTER_GAMETYPE(_("Team Deathmatch"),tdm,g_tdm,TEAM_DEATHMATCH,true,"","timelimit=20 pointlimit=50 teams=2 leadlimit=0",_("Help your team score the most frags against the enemy team"))
+ addstat(STAT_DODGING_TIMEOUT, AS_FLOAT, cvar_cl_dodging_timeout); // we stat this, so it is updated on the client when updated on server (otherwise, chaos)
+ if (!PHYS_MULTIJUMP_ADD) // in this case we make the z velocity == jumpvelocity
+ {
+ if (self.velocity_z < PHYS_JUMPVELOCITY)
+ {
+ player_multijump = true;
+ self.velocity_z = 0;
+ }
+ }
+ else
+ player_multijump = true;
+
+ if(player_multijump)
+ {
+ if(PHYS_MULTIJUMP_DODGING)
+ if(self.movement_x != 0 || self.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
+ {
+ float curspeed;
+ vector wishvel, wishdir;
+
+/*#ifdef SVQC
+ curspeed = max(
+ vlen(vec2(self.velocity)), // current xy speed
+ vlen(vec2(antilag_takebackavgvelocity(self, max(self.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
+ e.solid = SOLID_BBOX; // SOLID_BSP would be best, but can lag the server badly
+ e.movetype = MOVETYPE_TOSS;
+ e.frame = 0;
+ e.skin = 0;
+ e.material = string_null;
+ e.touch = sandbox_ObjectFunction_Touch;
+ e.think = sandbox_ObjectFunction_Think;
+ e.nextthink = time;
+ //e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
+
+ if(!database)
+ {
+ // set the object's owner via player UID
+ // if the player does not have an UID, the owner cannot be stored and his objects may be edited by anyone
+ if(self.crypto_idfp != "")
+ e.crypto_idfp = strzone(self.crypto_idfp);
+ else
+ print_to(self, "^1SANDBOX - WARNING: ^7You spawned an object, but lack a player UID. ^1Your objects are not secured and can be edited by any player!");
+
+ // set public object information
+ e.netname = strzone(self.netname); // name of the owner
+ e.message = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // creation time
+ e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // last editing time
+
+ // set origin and direction based on player position and view angle
+ if(MUTATOR_RETURNVALUE) // command was already handled?
+ return false;
+ if(cmd_name == "g_sandbox")
+ {
+ if(autocvar_g_sandbox_readonly)
+ {
+ print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active, but in read-only mode. Sandbox commands cannot be used");
+ return true;
+ }
+ if(cmd_argc < 2)
+ {
+ print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active. For usage information, type 'sandbox help'");
+ return true;
+ }
+
+ switch(argv(1))
+ {
+ entity e;
+ float i;
+ string s;
+
+ // ---------------- COMMAND: HELP ----------------
+ case "help":
+ print_to(self, "You can use the following sandbox commands:");
+ print_to(self, "^7\"^2object_spawn ^3models/foo/bar.md3^7\" spawns a new object in front of the player, and gives it the specified model");
+ print_to(self, "^7\"^2object_remove^7\" removes the object the player is looking at. Players can only remove their own objects");
+ print_to(self, "^7\"^2object_duplicate ^3value^7\" duplicates the object, if the player has copying rights over the original");
+ print_to(self, "^3copy value ^7- copies the properties of the object to the specified client cvar");
+ print_to(self, "^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\"");
+ print_to(self, "^7\"^2object_attach ^3property value^7\" attaches one object to another. Players can only attach their own objects");
+ print_to(self, "^3get ^7- selects the object you are facing as the object to be attached");
+ print_to(self, "^3set value ^7- attaches the previously selected object to the object you are facing, on the specified bone");
+ print_to(self, "^3remove ^7- detaches all objects from the object you are facing");
+ print_to(self, "^7\"^2object_edit ^3property value^7\" edits the given property of the object. Players can only edit their own objects");
+ print_to(self, "^3skin value ^7- changes the skin of the object");
+ print_to(self, "^3alpha value ^7- sets object transparency");
+ print_to(self, "^3colormod \"value_x value_y value_z\" ^7- main object color");
+ print_to(self, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
+ return true;
+ }
+ if(cmd_argc < 3)
+ {
+ print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object without specifying a model. Please specify the path to your model file after the 'object_spawn' command");
+ return true;
+ }
+ if (!(fexists(argv(2))))
+ {
+ print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object with a non-existent model. Make sure the path to your model file is correct");
+ return true;
+ }
+
+ e = sandbox_ObjectSpawn(false);
+ _setmodel(e, argv(2));
+
+ if(autocvar_g_sandbox_info > 0)
+ LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", self.netname, " spawned an object at origin ^3", vtos(e.origin), "\n"));
+ print_to(self, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
+ // select e as the object as meant to be attached
+ e = sandbox_ObjectEdit_Get(true);
+ if(e != world)
+ {
+ self.object_attach = e;
+ print_to(self, "^2SANDBOX - INFO: ^7Object selected for attachment");
+ return true;
+ }
+ print_to(self, "^1SANDBOX - WARNING: ^7Object could not be selected for attachment. Make sure you are facing an object that you have edit rights over");
+ return true;
+ case "set":
+ if(self.object_attach == world)
+ {
+ print_to(self, "^1SANDBOX - WARNING: ^7No object selected for attachment. Please select an object to be attached first.");
+ return true;
+ }
+
+ // attaches the previously selected object to e
+ e = sandbox_ObjectEdit_Get(true);
+ if(e != world)
+ {
+ sandbox_ObjectAttach_Set(self.object_attach, e, argv(3));
+ self.object_attach = world; // object was attached, no longer keep it scheduled for attachment
+ print_to(self, "^1SANDBOX - WARNING: ^7Object could not be attached to the parent. Make sure you are facing an object that you have edit rights over");
@@ -2573,7+2553,7 @@ Called every frame for each client after the physics are run
=============
*/
.float idlekick_lasttimeleft;
-void PlayerPostThink (void)
+void PlayerPostThink ()
{SELFPARAM();
if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
- if (flag.snd_flag_respawn == "") flag.snd_flag_respawn = SND(CTF_RESPAWN); // if there is ever a team-based sound for this, update the code to match.
+ if (flag.snd_flag_respawn == "") flag.snd_flag_respawn = strzone(SND(CTF_RESPAWN)); // if there is ever a team-based sound for this, update the code to match.
precache_sound(flag.snd_flag_respawn);
- if (flag.snd_flag_touch == "") flag.snd_flag_touch = SND(CTF_TOUCH); // again has no team-based sound
+ if (flag.snd_flag_touch == "") flag.snd_flag_touch = strzone(SND(CTF_TOUCH)); // again has no team-based sound
precache_sound(flag.snd_flag_touch);
- if (flag.snd_flag_pass == "") flag.snd_flag_pass = SND(CTF_PASS); // same story here
+ if (flag.snd_flag_pass == "") flag.snd_flag_pass = strzone(SND(CTF_PASS)); // same story here
void ka_SpawnBall() // loads various values for the ball, runs only once at start of match
{
- entity e;
- e = spawn();
+ entity e = new(keepawayball);
e.model = "models/orbs/orbblue.md3";
precache_model(e.model);
_setmodel(e, e.model);
setsize(e, '-16 -16 -20', '16 16 20'); // 20 20 20 was too big, player is only 16 16 24... gotta cheat with the Z (20) axis so that the particle isn't cut off
- This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams.
-
-keys:
-"target" - first control point.
-"target2" - second control point.
- */
-spawnfunc(onslaught_link)
-{
- if(!g_onslaught) { remove(self); return; }
-
- if (self.target == "" || self.target2 == "")
- objerror("target and target2 must be set\n");
-
- self.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist
- addstat(STAT_DODGING_TIMEOUT, AS_FLOAT, cvar_cl_dodging_timeout); // we stat this, so it is updated on the client when updated on server (otherwise, chaos)
- if (!PHYS_MULTIJUMP_ADD) // in this case we make the z velocity == jumpvelocity
- {
- if (self.velocity_z < PHYS_JUMPVELOCITY)
- {
- player_multijump = true;
- self.velocity_z = 0;
- }
- }
- else
- player_multijump = true;
-
- if(player_multijump)
- {
- if(PHYS_MULTIJUMP_DODGING)
- if(self.movement_x != 0 || self.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
- {
- float curspeed;
- vector wishvel, wishdir;
-
-/*#ifdef SVQC
- curspeed = max(
- vlen(vec2(self.velocity)), // current xy speed
- vlen(vec2(antilag_takebackavgvelocity(self, max(self.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
- e.solid = SOLID_BBOX; // SOLID_BSP would be best, but can lag the server badly
- e.movetype = MOVETYPE_TOSS;
- e.frame = 0;
- e.skin = 0;
- e.material = string_null;
- e.touch = sandbox_ObjectFunction_Touch;
- e.think = sandbox_ObjectFunction_Think;
- e.nextthink = time;
- //e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
-
- if(!database)
- {
- // set the object's owner via player UID
- // if the player does not have an UID, the owner cannot be stored and his objects may be edited by anyone
- if(self.crypto_idfp != "")
- e.crypto_idfp = strzone(self.crypto_idfp);
- else
- print_to(self, "^1SANDBOX - WARNING: ^7You spawned an object, but lack a player UID. ^1Your objects are not secured and can be edited by any player!");
-
- // set public object information
- e.netname = strzone(self.netname); // name of the owner
- e.message = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // creation time
- e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // last editing time
-
- // set origin and direction based on player position and view angle
- if(MUTATOR_RETURNVALUE) // command was already handled?
- return false;
- if(cmd_name == "g_sandbox")
- {
- if(autocvar_g_sandbox_readonly)
- {
- print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active, but in read-only mode. Sandbox commands cannot be used");
- return true;
- }
- if(cmd_argc < 2)
- {
- print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active. For usage information, type 'sandbox help'");
- return true;
- }
-
- switch(argv(1))
- {
- entity e;
- float i;
- string s;
-
- // ---------------- COMMAND: HELP ----------------
- case "help":
- print_to(self, "You can use the following sandbox commands:");
- print_to(self, "^7\"^2object_spawn ^3models/foo/bar.md3^7\" spawns a new object in front of the player, and gives it the specified model");
- print_to(self, "^7\"^2object_remove^7\" removes the object the player is looking at. Players can only remove their own objects");
- print_to(self, "^7\"^2object_duplicate ^3value^7\" duplicates the object, if the player has copying rights over the original");
- print_to(self, "^3copy value ^7- copies the properties of the object to the specified client cvar");
- print_to(self, "^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\"");
- print_to(self, "^7\"^2object_attach ^3property value^7\" attaches one object to another. Players can only attach their own objects");
- print_to(self, "^3get ^7- selects the object you are facing as the object to be attached");
- print_to(self, "^3set value ^7- attaches the previously selected object to the object you are facing, on the specified bone");
- print_to(self, "^3remove ^7- detaches all objects from the object you are facing");
- print_to(self, "^7\"^2object_edit ^3property value^7\" edits the given property of the object. Players can only edit their own objects");
- print_to(self, "^3skin value ^7- changes the skin of the object");
- print_to(self, "^3alpha value ^7- sets object transparency");
- print_to(self, "^3colormod \"value_x value_y value_z\" ^7- main object color");
- print_to(self, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
- return true;
- }
- if(cmd_argc < 3)
- {
- print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object without specifying a model. Please specify the path to your model file after the 'object_spawn' command");
- return true;
- }
- if (!(fexists(argv(2))))
- {
- print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object with a non-existent model. Make sure the path to your model file is correct");
- return true;
- }
-
- e = sandbox_ObjectSpawn(false);
- _setmodel(e, argv(2));
-
- if(autocvar_g_sandbox_info > 0)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", self.netname, " spawned an object at origin ^3", vtos(e.origin), "\n"));
- print_to(self, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
- // select e as the object as meant to be attached
- e = sandbox_ObjectEdit_Get(true);
- if(e != world)
- {
- self.object_attach = e;
- print_to(self, "^2SANDBOX - INFO: ^7Object selected for attachment");
- return true;
- }
- print_to(self, "^1SANDBOX - WARNING: ^7Object could not be selected for attachment. Make sure you are facing an object that you have edit rights over");
- return true;
- case "set":
- if(self.object_attach == world)
- {
- print_to(self, "^1SANDBOX - WARNING: ^7No object selected for attachment. Please select an object to be attached first.");
- return true;
- }
-
- // attaches the previously selected object to e
- e = sandbox_ObjectEdit_Get(true);
- if(e != world)
- {
- sandbox_ObjectAttach_Set(self.object_attach, e, argv(3));
- self.object_attach = world; // object was attached, no longer keep it scheduled for attachment
- print_to(self, "^1SANDBOX - WARNING: ^7Object could not be attached to the parent. Make sure you are facing an object that you have edit rights over");