Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
Sign in to follow this  
Eternal

Скрипт дефолтного бинта

Может я тупой, но не могу найти найти скрипт дефолтного бинта в котором используется выражение 

if (player.GetBleedingManagerServer() )
        {
            player.GetBleedingManagerServer().RemoveMostSignificantBleedingSource();    
        }

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

https://dayzexplorer.zeroy.com/_bleeding_sources_manager_server_8c_source.html
Нашёл только это
 

class BleedingSourcesManagerServer extends BleedingSourcesManagerBase
 {
  const float TICK_INTERVAL_SEC = 3;
  float m_Tick;
  bool m_DisableBloodLoss = false;
  ref array<int> m_DeleteList = new array<int>;
  
  const int STORAGE_VERSION = 103;
  
  protected BleedingSourceZone GetBleedingSourceZone(int bit)
  {
  return m_BleedingSourceZone.Get(GetSelectionNameFromBit(bit));
  }
  
  int GetStorageVersion()
  {
  return STORAGE_VERSION;
  }
  
  void RequestDeletion(int bit)
  {
  m_DeleteList.Insert(bit);
  }
  
  override protected void AddBleedingSource(int bit)
  {
  m_Player.SetBleedingBits(m_Player.GetBleedingBits() | bit );
  super.AddBleedingSource(bit);
  }
  
  override protected bool RemoveBleedingSource(int bit)
  {
  if(!super.RemoveBleedingSource(bit))
  {
  Error("Failed to remove bleeding source:" + bit);
  }
  
  int inverse_bit_mask = ~bit;
  m_Player.SetBleedingBits(m_Player.GetBleedingBits() & inverse_bit_mask );
  return true;
  }
  
  void RemoveAnyBleedingSource()
  {
  int bleeding_sources_bits = m_Player.GetBleedingBits();
  int rightmost_bit = bleeding_sources_bits & (-bleeding_sources_bits);
  
  RemoveBleedingSource(rightmost_bit);
  }
  
  void RemoveMostSignificantBleedingSource()
  {
  int bit = GetMostSignificantBleedingSource();
  RemoveBleedingSource(bit);
  }
  
  int GetMostSignificantBleedingSource()
  {
  int bleeding_sources_bits = m_Player.GetBleedingBits();
  
  float highest_flow;
  int highest_flow_bit;
  int bit_offset;
  
  for(int i = 0; i < BIT_INT_SIZE; i++)
  {
  int bit = 1 << bit_offset;
  
  if( (bit & bleeding_sources_bits) != 0 )
  {
  BleedingSourceZone meta = GetBleedingSourceMeta(bit);
  if(meta)
  {
  if( meta.GetFlowModifier() > highest_flow )
  {
  highest_flow = meta.GetFlowModifier();
  highest_flow_bit = bit;
  //Print(meta.GetSelectionName());
  }
  }
  }
   bit_offset++;
  }
  return highest_flow_bit;
  }
  
  void OnTick(float delta_time)
  {
  m_Tick += delta_time;
  if( m_Tick > TICK_INTERVAL_SEC )
  {
  while( m_DeleteList.Count() > 0 )
  {
  RemoveBleedingSource(m_DeleteList.Get(0));
  m_DeleteList.Remove(0);
  } 
  
  float blood_scale = Math.InverseLerp(PlayerConstants.BLOOD_THRESHOLD_FATAL, PlayerConstants.BLEEDING_LOW_PRESSURE_BLOOD, m_Player.GetHealth( "GlobalHealth", "Blood" ));
  blood_scale = Math.Clamp( blood_scale, PlayerConstants.BLEEDING_LOW_PRESSURE_MIN_MOD, 1 );
  
  for(int i = 0; i < m_BleedingSources.Count(); i++)
  {
  m_BleedingSources.GetElement(i).OnUpdateServer( TICK_INTERVAL_SEC, blood_scale, m_DisableBloodLoss );
  }
  m_Tick = 0;
  }
  }
  
  void ActivateAllBS()
  {
  for(int i = 0; i < m_BleedingSourceZone.Count(); i++)
  {
  int bit = m_BleedingSourceZone.GetElement(i).GetBit();
  if( CanAddBleedingSource(bit) )
  {
  AddBleedingSource(bit);
  }
  }
  }
  
  //damage must be to "Blood" healthType
  void ProcessHit(float damage, EntityAI source, int component, string zone, string ammo, vector modelPos)
  {
  float dmg_max = m_Player.GetMaxHealth(zone, "Blood");
  float dmg = damage;
  float bleed_threshold = GetGame().ConfigGetFloat( "CfgAmmo " + ammo + " DamageApplied " + "bleedThreshold" );
  bleed_threshold = Math.Clamp(bleed_threshold,0,1);
  //Print("dmg_max = " + dmg_max);
  //Print("dmg = " + dmg);
  //Print("bleed_threshold = " + bleed_threshold);
  
  //hackerino for zombino:
  if (source.IsZombie())
  {
  int chance = Math.RandomInt(0,10); //10%
  if (chance == 1)
  {
  AttemptAddBleedingSource(component);
  }
  }
  else if ( dmg > (dmg_max * (1 - bleed_threshold)) )
  {
  AttemptAddBleedingSource(component);
  //Print("BLEEDING");
  }
  
  }
  
  void DebugActivateBleedingSource(int source)
  {
  RemoveAllSources();
  
  if(source >= m_BleedingSourceZone.Count() || !m_BleedingSourceZone.GetElement(source)) return;
  
  int bit = m_BleedingSourceZone.GetElement(source).GetBit();
  
  if( bit && CanAddBleedingSource(bit) )
  {
  AddBleedingSource(bit);
  }
  }
  
  void SetBloodLoss(bool status)
  {
  m_DisableBloodLoss = status;
  }
  
  void OnStoreSave( ParamsWriteContext ctx )
  {
  //int count = m_BleedingSources.Count();
  int active_bits = m_Player.GetBleedingBits();
  ctx.Write(active_bits);
  
  int bit_offset = 0;
  for(int i = 0; i < BIT_INT_SIZE; i++)
  {
  int bit = 1 << bit_offset;
  if( (bit & active_bits) != 0 )
  {
  int active_time = GetBleedingSourceActiveTime(bit);
  ctx.Write(active_time);
  }
  bit_offset++;
  }
  }
  
  bool OnStoreLoad( ParamsReadContext ctx, int version )
  {
  int active_bits;
  if(!ctx.Read(active_bits))
  {
  return false;
  }
  
  int bit_offset = 0;
  for(int i = 0; i < BIT_INT_SIZE; i++)
  {
  int bit = 1 << bit_offset;
  if( (bit & active_bits) != 0 && CanAddBleedingSource(bit))
  {
  AddBleedingSource(bit);
  int active_time = 0;
  if(!ctx.Read(active_time))
  {
  return false;
  }
  else
  {
  SetBleedingSourceActiveTime(bit,active_time);
  }
  
  }
  bit_offset++;
  }
  return true;
  }
  
  void ~BleedingSourcesManagerServer()
  {
  if (m_Player && !m_Player.IsAlive())
  RemoveAllSources();
  }
 }

 

Share this post


Link to post
Share on other sites







  • 0
10.07.2021 в 23:44, DrZiLLo сказал:

https://dayzexplorer.zeroy.com/_bleeding_sources_manager_server_8c_source.html
Нашёл только это

class BleedingSourcesManagerServer extends BleedingSourcesManagerBase { const float TICK_INTERVAL_SEC = 3; float m_Tick; bool m_DisableBloodLoss = false; ref array<int> m_DeleteList = new array<int>; const int STORAGE_VERSION = 103; protected BleedingSourceZone GetBleedingSourceZone(int bit) { return m_BleedingSourceZone.Get(GetSelectionNameFromBit(bit)); } int GetStorageVersion() { return STORAGE_VERSION; } void RequestDeletion(int bit) { m_DeleteList.Insert(bit); } override protected void AddBleedingSource(int bit) { m_Player.SetBleedingBits(m_Player.GetBleedingBits() | bit ); super.AddBleedingSource(bit); } override protected bool RemoveBleedingSource(int bit) { if(!super.RemoveBleedingSource(bit)) { Error("Failed to remove bleeding source:" + bit); } int inverse_bit_mask = ~bit; m_Player.SetBleedingBits(m_Player.GetBleedingBits() & inverse_bit_mask ); return true; } void RemoveAnyBleedingSource() { int bleeding_sources_bits = m_Player.GetBleedingBits(); int rightmost_bit = bleeding_sources_bits & (-bleeding_sources_bits); RemoveBleedingSource(rightmost_bit); } void RemoveMostSignificantBleedingSource() { int bit = GetMostSignificantBleedingSource(); RemoveBleedingSource(bit); } int GetMostSignificantBleedingSource() { int bleeding_sources_bits = m_Player.GetBleedingBits(); float highest_flow; int highest_flow_bit; int bit_offset; for(int i = 0; i < BIT_INT_SIZE; i++) { int bit = 1 << bit_offset; if( (bit & bleeding_sources_bits) != 0 ) { BleedingSourceZone meta = GetBleedingSourceMeta(bit); if(meta) { if( meta.GetFlowModifier() > highest_flow ) { highest_flow = meta.GetFlowModifier(); highest_flow_bit = bit; //Print(meta.GetSelectionName()); } } } bit_offset++; } return highest_flow_bit; } void OnTick(float delta_time) { m_Tick += delta_time; if( m_Tick > TICK_INTERVAL_SEC ) { while( m_DeleteList.Count() > 0 ) { RemoveBleedingSource(m_DeleteList.Get(0)); m_DeleteList.Remove(0); } float blood_scale = Math.InverseLerp(PlayerConstants.BLOOD_THRESHOLD_FATAL, PlayerConstants.BLEEDING_LOW_PRESSURE_BLOOD, m_Player.GetHealth( "GlobalHealth", "Blood" )); blood_scale = Math.Clamp( blood_scale, PlayerConstants.BLEEDING_LOW_PRESSURE_MIN_MOD, 1 ); for(int i = 0; i < m_BleedingSources.Count(); i++) { m_BleedingSources.GetElement(i).OnUpdateServer( TICK_INTERVAL_SEC, blood_scale, m_DisableBloodLoss ); } m_Tick = 0; } } void ActivateAllBS() { for(int i = 0; i < m_BleedingSourceZone.Count(); i++) { int bit = m_BleedingSourceZone.GetElement(i).GetBit(); if( CanAddBleedingSource(bit) ) { AddBleedingSource(bit); } } } //damage must be to "Blood" healthType void ProcessHit(float damage, EntityAI source, int component, string zone, string ammo, vector modelPos) { float dmg_max = m_Player.GetMaxHealth(zone, "Blood"); float dmg = damage; float bleed_threshold = GetGame().ConfigGetFloat( "CfgAmmo " + ammo + " DamageApplied " + "bleedThreshold" ); bleed_threshold = Math.Clamp(bleed_threshold,0,1); //Print("dmg_max = " + dmg_max); //Print("dmg = " + dmg); //Print("bleed_threshold = " + bleed_threshold); //hackerino for zombino: if (source.IsZombie()) { int chance = Math.RandomInt(0,10); //10% if (chance == 1) { AttemptAddBleedingSource(component); } } else if ( dmg > (dmg_max * (1 - bleed_threshold)) ) { AttemptAddBleedingSource(component); //Print("BLEEDING"); } } void DebugActivateBleedingSource(int source) { RemoveAllSources(); if(source >= m_BleedingSourceZone.Count() || !m_BleedingSourceZone.GetElement(source)) return; int bit = m_BleedingSourceZone.GetElement(source).GetBit(); if( bit && CanAddBleedingSource(bit) ) { AddBleedingSource(bit); } } void SetBloodLoss(bool status) { m_DisableBloodLoss = status; } void OnStoreSave( ParamsWriteContext ctx ) { //int count = m_BleedingSources.Count(); int active_bits = m_Player.GetBleedingBits(); ctx.Write(active_bits); int bit_offset = 0; for(int i = 0; i < BIT_INT_SIZE; i++) { int bit = 1 << bit_offset; if( (bit & active_bits) != 0 ) { int active_time = GetBleedingSourceActiveTime(bit); ctx.Write(active_time); } bit_offset++; } } bool OnStoreLoad( ParamsReadContext ctx, int version ) { int active_bits; if(!ctx.Read(active_bits)) { return false; } int bit_offset = 0; for(int i = 0; i < BIT_INT_SIZE; i++) { int bit = 1 << bit_offset; if( (bit & active_bits) != 0 && CanAddBleedingSource(bit)) { AddBleedingSource(bit); int active_time = 0; if(!ctx.Read(active_time)) { return false; } else { SetBleedingSourceActiveTime(bit,active_time); } } bit_offset++; } return true; } void ~BleedingSourcesManagerServer() { if (m_Player && !m_Player.IsAlive()) RemoveAllSources(); } }

 

Вот за ссылку спасибо, покопался там и нашел

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.