Merge remote-tracking branch 'origin/master' into samual/mutator_ctf
authorSamual Lenks <samual@xonotic.org>
Wed, 29 Aug 2012 05:14:44 +0000 (01:14 -0400)
committerSamual Lenks <samual@xonotic.org>
Wed, 29 Aug 2012 05:14:44 +0000 (01:14 -0400)
Conflicts:
qcsrc/server/mutators/base.qh
qcsrc/server/progs.src
qcsrc/server/vehicles/vehicles.qc
vehicles.cfg

21 files changed:
1  2 
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/waypointsprites.qc
qcsrc/common/items.qh
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_triggers.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/mutators.qh
qcsrc/server/progs.src
qcsrc/server/t_teleporters.qc
qcsrc/server/teamplay.qc
qcsrc/server/tturrets/units/unit_ewheel.qc
qcsrc/server/tturrets/units/unit_walker.qc
qcsrc/server/vehicles/vehicles.qc
vehicles.cfg

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -415,8 -415,11 +415,8 @@@ void PutObserverInServer (void
        }
  
        if(self.vehicle)
-           vehicles_exit(VHEF_RELESE);
+               vehicles_exit(VHEF_RELESE);         
  
 -      if(self.flagcarried)
 -              DropFlag(self.flagcarried, world, world);
 -
        WaypointSprite_PlayerDead();
  
        if not(g_ca)  // don't reset teams when moving a ca player to the spectators
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -213,35 -213,11 +213,44 @@@ MUTATOR_HOOKABLE(SetWeaponreplace)
        // IN+OUT
                string ret_string;
  
-       entity self; // player
 +MUTATOR_HOOKABLE(PortalTeleport);
 +      // called whenever a player goes through a portal gun teleport
 +      // allows you to strip a player of an item if they go through the teleporter to help prevent cheating
 +      // INPUT
 +      entity self;
 +      
 +MUTATOR_HOOKABLE(HelpMePing);
 +      // called whenever a player uses impulse 33 (help me) in cl_impulse.qc
 +      // normally help me ping uses self.waypointsprite_attachedforcarrier,
 +      // but if your mutator uses something different then you can handle it
 +      // in a special manner using this hook
 +      // INPUT
 +      entity self; // the player who pressed impulse 33
 +      
 +MUTATOR_HOOKABLE(VehicleEnter);
 +      // called when a player enters a vehicle
 +      // allows mutators to set special settings in this event
 +      // INPUT
 +      entity other; // player
 +      entity self; // vehicle
 +      
 +MUTATOR_HOOKABLE(VehicleExit);
 +      // called when a player exits a vehicle
 +      // allows mutators to set special settings in this event
 +      // INPUT
 +      entity other; // player
 +      entity self; // vehicle
 +      
 +MUTATOR_HOOKABLE(AbortSpeedrun);
 +      // called when a speedrun is aborted and the player is teleported back to start position
 +      // INPUT
++      entity self; // player
++
+ MUTATOR_HOOKABLE(ItemTouch);
+       // called at when a item is touched. Called early, can edit item properties.
+       entity self;    // item
+       entity other;   // player
+ MUTATOR_HOOKABLE(ClientConnect);
+       // called at when a player connect
+       entity self;    // player
@@@ -1,8 -1,8 +1,9 @@@
  MUTATOR_DECLARATION(gamemode_keyhunt);
  MUTATOR_DECLARATION(gamemode_freezetag);
  MUTATOR_DECLARATION(gamemode_keepaway);
 +MUTATOR_DECLARATION(gamemode_ctf);
  MUTATOR_DECLARATION(gamemode_nexball);
+ MUTATOR_DECLARATION(gamemode_onslaught);
  
  MUTATOR_DECLARATION(mutator_dodging);
  MUTATOR_DECLARATION(mutator_invincibleprojectiles);
@@@ -139,9 -138,9 +139,9 @@@ cl_client.q
  t_plats.qc
  antilag.qc
  
 -ctf.qc
 +//ctf.qc
  domination.qc
- mode_onslaught.qc
//mode_onslaught.qc
  //nexball.qc
  g_hook.qc
  
@@@ -206,11 -205,11 +206,12 @@@ playerstats.q
  ../common/explosion_equation.qc
  
  mutators/base.qc
 -mutators/gamemode_nexball.qc
 -mutators/gamemode_keyhunt.qc
 +mutators/gamemode_ctf.qc
  mutators/gamemode_freezetag.qc
 +mutators/gamemode_keyhunt.qc
  mutators/gamemode_keepaway.qc
 +mutators/gamemode_nexball.qc
+ mutators/gamemode_onslaught.qc
  mutators/mutator_invincibleproj.qc
  mutators/mutator_new_toys.qc
  mutators/mutator_nix.qc
Simple merge
Simple merge
@@@ -2,7 -2,16 +2,15 @@@ float autocvar_g_vehicles_crush_dmg
  float autocvar_g_vehicles_crush_force;
  float autocvar_g_vehicles_delayspawn;
  float autocvar_g_vehicles_delayspawn_jitter;
 -float autocvar_g_vehicles_allow_flagcarry;
  
+ var float autocvar_g_vehicles_nex_damagerate = 0.5;
+ var float autocvar_g_vehicles_uzi_damagerate = 0.5;
+ var float autocvar_g_vehicles_rifle_damagerate = 0.75;
+ var float autocvar_g_vehicles_minstanex_damagerate = 0.001;
+ var float autocvar_g_vehicles_tag_damagerate = 5;
+ float autocvar_g_vehicles;
  void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
  void vehicles_return();
  void vehicles_enter();
@@@ -519,9 -658,19 +658,9 @@@ void vehicles_enter(
      vehicles_clearrturn();
  
      CSQCVehicleSetup(self.owner, self.hud);
 -
 -    if(other.flagcarried)
 -    {
 -        if(!autocvar_g_vehicles_allow_flagcarry)
 -            DropFlag(other.flagcarried, world, world);
 -        else
 -        {
 -            other.flagcarried.scale = 1;
 -            setattachment(other.flagcarried, self, "");
 -            setorigin(other.flagcarried, self.maxs_z * '0 0 1');
 -        }
 -    }
 +    
 +    MUTATOR_CALLHOOK(VehicleEnter);
-     
      self.vehicle_enter();
      antilag_clear(other);
  }
@@@ -583,69 -732,100 +722,97 @@@ vector vehicles_findgoodexit(vector pre
      Standarrd vehicle release fucntion.
      custom code goes in self.vehicle_exit
  **/
+ float vehicles_exit_running;
  void vehicles_exit(float eject)
- {     
-     entity oldself;
+ {
+     entity _vehicle;
+     entity _player;
+     entity _oldself = self;
+     
+     if(vehicles_exit_running)
+     {
+         dprint("^1vehicles_exit allready running! this is not good..\n");
+         return;
+     }
+     
+     vehicles_exit_running = TRUE;
      if(self.flags & FL_CLIENT)
      {
-         oldself = self;
-         self = self.vehicle;
+         _vehicle = self.vehicle;
+             
+         if (_vehicle.vehicle_flags & VHF_PLAYERSLOT)
+         {
+             _vehicle.vehicle_exit(eject);
+             self = _oldself;
+             vehicles_exit_running = FALSE;
+             return;            
+         }
      }
+     else
+         _vehicle = self;
      
-       self.flags |= FL_NOTARGET;
+     _player = _vehicle.owner;
+     
+     self = _vehicle;
  
-     if (self.owner)
+     if (_player)
      {
-         msg_entity = self.owner;
-         WriteByte (MSG_ONE, SVC_SETVIEWPORT);
-         WriteEntity( MSG_ONE, self.owner);
-         WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
-         WriteAngle(MSG_ONE, 0);                 // pich
-         WriteAngle(MSG_ONE, self.angles_y);     // yaw
-         WriteAngle(MSG_ONE, 0);                 // roll
-         setsize(self.owner, PL_MIN,PL_MAX);
-         self.owner.takedamage     = DAMAGE_AIM;
-         self.owner.solid          = SOLID_SLIDEBOX;
-         self.owner.movetype       = MOVETYPE_WALK;
-         self.owner.effects        &~= EF_NODRAW;
-         self.owner.alpha          = 1;
-         self.owner.PlayerPhysplug = SUB_Null;
-         self.owner.vehicle        = world;
-         self.owner.view_ofs       = PL_VIEW_OFS;
-         self.owner.event_damage   = PlayerDamage;
-         self.owner.hud            = HUD_NORMAL;
-         self.owner.switchweapon   = self.switchweapon;
-         //self.owner.BUTTON_USE     = 0;
+         if (clienttype(_player) == CLIENTTYPE_REAL)
+         {
+             msg_entity = _player;
+             WriteByte (MSG_ONE, SVC_SETVIEWPORT);
+             WriteEntity( MSG_ONE, _player);
+             WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
+             WriteAngle(MSG_ONE, 0);
+             WriteAngle(MSG_ONE, _vehicle.angles_y);
+             WriteAngle(MSG_ONE, 0);
+         }
          
-         CSQCVehicleSetup(self.owner, HUD_NORMAL);
-     }
-     if(self.deadflag == DEAD_NO)
-         self.avelocity          = '0 0 0';
-     self.vehicle_hudmodel.viewmodelforclient = self;
-       self.tur_head.nodrawtoclient             = world;
-     vehicles_setreturn();
-     self.phase = time + 1;
+         setsize(_player, PL_MIN,PL_MAX);
+         _player.takedamage     = DAMAGE_AIM;
+         _player.solid          = SOLID_SLIDEBOX;
+         _player.movetype       = MOVETYPE_WALK;
+         _player.effects        &~= EF_NODRAW;
+         _player.alpha          = 1;
+         _player.PlayerPhysplug = SUB_Null;
+         _player.vehicle        = world;
+         _player.view_ofs       = PL_VIEW_OFS;
+         _player.event_damage   = PlayerDamage;
+         _player.hud            = HUD_NORMAL;
+         _player.switchweapon   = _vehicle.switchweapon;
+         if(_player.flagcarried)
+         {
+             _player.flagcarried.scale = 0.6;
+             setattachment(_player.flagcarried, _player, "");
+             setorigin(_player.flagcarried, FLAG_CARRY_POS);
+         }
  
+         CSQCVehicleSetup(_player, HUD_NORMAL);
+     }
+     _vehicle.flags |= FL_NOTARGET;
+     
+     if(_vehicle.deadflag == DEAD_NO)
+         _vehicle.avelocity          = '0 0 0';
+     
+     _vehicle.tur_head.nodrawtoclient             = world;
+     
      if(!teamplay)
-         self.team = 0;
+         _vehicle.team = 0;
      else
-         self.team = self.tur_head.team;
 -        _vehicle.team = _vehicle.tur_head.team;
 -        
 -    sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTN_NORM);
 -    _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle;  
 -    _vehicle.phase = time + 1;
+     
 -    _vehicle.vehicle_exit(eject);
++    self.team = self.tur_head.team;
 +   
 +    MUTATOR_CALLHOOK(VehicleExit);
      
-     sound (self, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTN_NORM);
-     self.vehicle_exit(eject);
-     self.owner = world;
-     vehicles_reset_colors();
+     vehicles_setreturn();
+     vehicles_reset_colors();        
+     _vehicle.owner = world;
+     self = _oldself;
      
-     if(oldself)
-         self = oldself;
+     vehicles_exit_running = FALSE;
  }
  
  
@@@ -981,10 -1265,10 +1252,11 @@@ float vehicle_initialize(string  net_na
      self.takedamage         = DAMAGE_AIM;
      self.bot_attack         = TRUE;
      self.iscreature         = TRUE;
 +    self.teleportable       = FALSE; // no teleporting for vehicles, too buggy
      self.damagedbycontents    = TRUE;
      self.hud                = vhud;
+     self.tur_health          = _max_health;
+     self.tur_head.tur_health = _max_shield;
      self.vehicle_die         = dieproc;
      self.vehicle_exit        = exitfunc;
      self.vehicle_enter       = enterproc;
      return TRUE;
  }
  
- void bugmenot()
+ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname, 
+                          float _pichlimit_min, float _pichlimit_max, 
+                          float _rotlimit_min, float _rotlimit_max, float _aimspeed)
  {
-     self.vehicle_exit       = self.vehicle_exit;
-     self.vehicle_enter      = self.vehicle_exit;
-     self.vehicle_die        = self.vehicle_exit;
-     self.vehicle_spawn      = self.vehicle_exit;
-     self.AuxiliaryXhair     = self.AuxiliaryXhair;
+     vector vtmp, vtag;
+     float ftmp;
+     vtag = gettaginfo(_turrret, gettagindex(_turrret, _tagname));
+     vtmp = vectoangles(normalize(_target - vtag));
+     vtmp = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(_vehic.angles), AnglesTransform_FromAngles(vtmp))) - _turrret.angles;
+     vtmp = AnglesTransform_Normalize(vtmp, TRUE);
+     ftmp = _aimspeed * frametime;
+     vtmp_y = bound(-ftmp, vtmp_y, ftmp);
+     vtmp_x = bound(-ftmp, vtmp_x, ftmp);
+     _turrret.angles_y = bound(_rotlimit_min, _turrret.angles_y + vtmp_y, _rotlimit_max);    
+     _turrret.angles_x = bound(_pichlimit_min, _turrret.angles_x + vtmp_x, _pichlimit_max);
+     return vtag;
  }
 -*/
+ void vehicles_gib_explode()
+ {
+       sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
+       pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
+       remove(self);
+ }
+ void vehicles_gib_think()
+ {
+       self.alpha -= 0.1;
+       if(self.cnt >= time)
+               remove(self);
+       else
+               self.nextthink = time + 0.1;
+ }
+ entity vehicle_tossgib(entity _template, vector _vel, string _tag, float _burn, float _explode, float _maxtime, vector _rot)
+ {
+       entity _gib = spawn();
+       setmodel(_gib, _template.model);
+       setorigin(_gib, gettaginfo(self, gettagindex(self, _tag)));
+       _gib.velocity = _vel;
+       _gib.movetype = MOVETYPE_TOSS;
+       _gib.solid = SOLID_CORPSE;
+       _gib.colormod = '-0.5 -0.5 -0.5';
+       _gib.effects = EF_LOWPRECISION; 
+       _gib.avelocity = _rot;
+       
+       if(_burn)
+               _gib.effects |= EF_FLAME;
+       
+       if(_explode)
+       {
+               _gib.think = vehicles_gib_explode; 
+               _gib.nextthink = time + random() * _explode;
+               _gib.touch = vehicles_gib_explode;
+       }
+       else
+       {
+               _gib.cnt = time + _maxtime;
+               _gib.think = vehicles_gib_think; 
+               _gib.nextthink = time + _maxtime - 1;           
+               _gib.alpha = 1;
+       }
+       return _gib;
+ }
+ /*
+ vector predict_target(entity _targ, vector _from, float _shot_speed)
+ {
+     float i;                // loop
+     float _distance;        // How far to target
+     float _impact_time;     // How long untill projectile impacts
+     vector _predict_pos;    // Predicted enemy location
+     vector _original_origin;// Where target is before predicted
+      _original_origin = real_origin(_targ); // Typicaly center of target BBOX
+     _predict_pos = _original_origin;
+     for(i = 0; i < 4; ++i)  // Loop a few times to increase prediction accuracy (increase loop count if accuracy is to low)
+     {
+         _distance = vlen(_predict_pos - _from); // Get distance to previos predicted location
+         _impact_time = _distance / _shot_speed; // Calculate impact time
+         _predict_pos = _original_origin + _targ.velocity * _impact_time; // Calculate new predicted location
+     }
+     return _predict_pos;
+ }
++*/
diff --cc vehicles.cfg
@@@ -16,3 -17,10 +17,10 @@@ set cl_vehicles_hudscale 0.5wa
  
  set g_vehicles_delayspawn 1
  set g_vehicles_delayspawn_jitter 10
 -set g_vehicles_allow_flagcarry 1
+ set g_vehicles_nex_damagerate 0.5
+ set g_vehicles_uzi_damagerate 0.65
+ set g_vehicles_rifle_damagerate 1
+ set g_vehicles_minstanex_damagerate 0.001
 -set g_vehicles_tag_damagerate 2
++set g_vehicles_tag_damagerate 2
++