]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/monsters
authorMario <mario@smbclan.net>
Sat, 3 Feb 2018 15:45:20 +0000 (01:45 +1000)
committerMario <mario@smbclan.net>
Sat, 3 Feb 2018 15:45:20 +0000 (01:45 +1000)
1  2 
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/triggers/func/breakable.qc
qcsrc/server/autocvars.qh

index 527827c3913e0653f4b7d63c43940cc4a298e34a,15fba0134200deccbfacf77b8f70af222558ef4f..a71c05ea916c9b3dcfa725ad4af6a223c5bf0f04
@@@ -124,27 -124,21 +124,27 @@@ entity Monster_FindTarget(entity this
        vector my_center = CENTER_OR_VIEWOFS(this);
  
        // find the closest acceptable target to pass to
 -      IL_EACH(g_monster_targets, it.monster_attack && vdist(it.origin - this.origin, <, this.target_range),
 +      IL_EACH(g_monster_targets, it.monster_attack,
        {
 -              if(Monster_ValidTarget(this, it))
 -              {
 -                      // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
 -                      vector targ_center = CENTER_OR_VIEWOFS(it);
 +              float trange = this.target_range;
 +              if(PHYS_INPUT_BUTTON_CROUCH(it))
 +                      trange *= 0.75; // TODO cvar this
 +              vector theirmid = (it.absmin + it.absmax) * 0.5;
 +              if(vdist(theirmid - this.origin, >, trange))
 +                      continue;
 +              if(!Monster_ValidTarget(this, it))
 +                      continue;
  
 -                      if(closest_target)
 -                      {
 -                              vector closest_target_center = CENTER_OR_VIEWOFS(closest_target);
 -                              if(vlen2(my_center - targ_center) < vlen2(my_center - closest_target_center))
 -                                      { closest_target = it; }
 -                      }
 -                      else { closest_target = it; }
 +              // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
 +              vector targ_center = CENTER_OR_VIEWOFS(it);
 +
 +              if(closest_target)
 +              {
 +                      vector closest_target_center = CENTER_OR_VIEWOFS(closest_target);
 +                      if(vlen2(my_center - targ_center) < vlen2(my_center - closest_target_center))
 +                              { closest_target = it; }
                }
 +              else { closest_target = it; }
        });
  
        return closest_target;
@@@ -171,11 -165,6 +171,11 @@@ void monster_setupcolors(entity this
                else
                        this.colormap = 1024;
        }
 +
 +      if(this.colormap > 0)
 +              this.glowmod = colormapPaletteColor(this.colormap & 0x0F, false);
 +      else
 +              this.glowmod = '1 1 1';
  }
  
  void monster_changeteam(entity this, int newteam)
@@@ -347,7 -336,12 +347,12 @@@ void Monster_Sound(entity this, .strin
        if(delaytoo)
        if(time < this.msound_delay)
                return; // too early
-       GlobalSound_string(this, this.(samplefield), chan, VOL_BASE, VOICETYPE_PLAYERSOUND);
+       string sample = this.(samplefield);
+       if (sample != "") sample = GlobalSound_sample(sample, random());
+       float myscale = ((this.scale) ? this.scale : 1); // safety net
+       float scale_inverse = 1 / myscale;
+       // TODO: change volume depending on size too?
+       sound7(this, chan, sample, VOL_BASE, ATTEN_NORM, scale_inverse * 100, 0);
  
        this.msound_delay = time + sound_delay;
  }
@@@ -1394,7 -1388,7 +1399,7 @@@ bool Monster_Spawn(entity this, bool ch
        if(autocvar_g_nodepthtestplayers) { this.effects |= EF_NODEPTHTEST; }
        if(mon.spawnflags & MONSTER_TYPE_SWIM) { this.flags |= FL_SWIM; }
  
 -      if(autocvar_g_playerclip_collisions)
 +      if(autocvar_g_monsters_playerclip_collisions)
                this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
  
        if(mon.spawnflags & MONSTER_TYPE_FLY)
                set_movetype(this, MOVETYPE_FLY);
        }
  
 -      if(!(this.spawnflags & MONSTERFLAG_RESPAWNED))
 -      {
 -              if(mon.spawnflags & MONSTER_SIZE_BROKEN)
 -                      this.scale *= 1.3;
 -
 -              if(mon.spawnflags & MONSTER_SIZE_QUAKE)
 -              if(autocvar_g_monsters_quake_resize)
 -                      this.scale *= 1.3;
 -      }
 +      if((mon.spawnflags & MONSTER_SIZE_QUAKE) && autocvar_g_monsters_quake_resize && !(this.spawnflags & MONSTERFLAG_RESPAWNED))
 +              this.scale *= 1.3;
  
        setsize(this, mon.m_mins * this.scale, mon.m_maxs * this.scale);
  
index 195fed22c1cb58f7f25f9f76454993471667b52a,84e5581c8d7e521d7e6aa7e61f2a9fb4508a4d67..f4644816170ac745059fd7c86a395d3e98674789
@@@ -67,7 -67,8 +67,8 @@@ void LaunchDebris (entity this, string 
        dbr.velocity_x = this.debrisvelocity.x + this.debrisvelocityjitter.x * crandom();
        dbr.velocity_y = this.debrisvelocity.y + this.debrisvelocityjitter.y * crandom();
        dbr.velocity_z = this.debrisvelocity.z + this.debrisvelocityjitter.z * crandom();
-       this.velocity = this.velocity + force * this.debrisdamageforcescale;
+       dbr.velocity = dbr.velocity + force * this.debrisdamageforcescale;
+       dbr.angles = this.angles;
        dbr.avelocity_x = random()*this.debrisavelocityjitter.x;
        dbr.avelocity_y = random()*this.debrisavelocityjitter.y;
        dbr.avelocity_z = random()*this.debrisavelocityjitter.z;
@@@ -339,7 -340,6 +340,7 @@@ spawnfunc(func_breakable
                this.takedamage = DAMAGE_NO;
                this.event_damage = func_null;
                this.bot_attack = false;
 +              this.monster_attack = false;
        }
  
        // precache all the models
        this.reset = func_breakable_reset;
        this.reset(this);
  
 +      if(this.monster_attack)
 +              IL_PUSH(g_monster_targets, this);
 +
        IL_PUSH(g_initforplayer, this);
        this.init_for_player = func_breakable_init_for_player;
  
index 41009c13801672117f95e5fbb0c5422d0a146bb4,80da3f403ac97c025274b109d1ede8f5c8c8ea83..35d720718b8acef3d63a00fe0f177fe3eb2496d8
@@@ -330,6 -330,8 +330,8 @@@ bool autocvar_sv_ready_restart_repeatab
  bool autocvar_sv_servermodelsonly;
  int autocvar_sv_spectate;
  float autocvar_sv_spectator_speed_multiplier;
+ float autocvar_sv_spectator_speed_multiplier_min = 1;
+ float autocvar_sv_spectator_speed_multiplier_max = 5;
  bool autocvar_sv_status_privacy;
  float autocvar_sv_stepheight;
  float autocvar_sv_strengthsound_antispam_refire_threshold;
@@@ -401,7 -403,6 +403,7 @@@ int autocvar_g_monsters_score_kill
  int autocvar_g_monsters_score_spawned;
  bool autocvar_g_monsters_typefrag;
  bool autocvar_g_monsters_owners;
 +bool autocvar_g_monsters_playerclip_collisions;
  float autocvar_g_monsters_miniboss_chance;
  float autocvar_g_monsters_miniboss_healthboost;
  float autocvar_g_monsters_drop_time;