@@ -268,6 +268,33 @@ public void SetArmorValue(int value) {
268268 }
269269 }
270270
271+ public static readonly new DataMap DataDesc = new ( typeof ( BasePlayer ) , BaseCombatCharacter . DataDesc , [
272+ DEFINE < BasePlayer > . INPUTFUNC ( FieldType . Integer , "SetHealth" , nameof ( InputSetHealth ) , ( INPUTFUNCPTR ) ( ( self , data ) => ( ( BasePlayer ) self ) . InputSetHealth ( data ) ) ) ,
273+ ] ) ;
274+ public override DataMap ? GetDataDescMap ( ) => DataDesc ;
275+
276+ public override int TakeHealth ( float health , DamageType damageType ) {
277+ if ( m_takedamage != 0 ) {
278+ DamageType bitsDmgTimeBased = g_pGameRules . Damage_GetTimeBased ( ) ;
279+ bitsDamageType &= ~ ( damageType & ~ bitsDmgTimeBased ) ;
280+ }
281+
282+ return base . TakeHealth ( health , damageType ) ;
283+ }
284+
285+ public void InputSetHealth ( InputData inputdata ) {
286+ int newHealth = inputdata . Value . Int ( ) ;
287+ int delta = Math . Abs ( GetHealth ( ) - newHealth ) ;
288+ if ( newHealth > GetHealth ( ) )
289+ TakeHealth ( delta , DamageType . Generic ) ;
290+ else if ( newHealth < GetHealth ( ) ) {
291+ int armor = ArmorValue ;
292+ ArmorValue = 0 ;
293+ TakeDamage ( new TakeDamageInfo ( this , this , delta , DamageType . Generic ) ) ;
294+ ArmorValue = armor ;
295+ }
296+ }
297+
271298 static InlineArray1024 < char > InfoBuffer ;
272299
273300 public ReadOnlySpan < char > GetInfo ( ReadOnlySpan < char > name ) {
@@ -696,6 +723,14 @@ public void UnforceButtons(InButtons buttons) {
696723 AfButtonForced &= ~ buttons ;
697724 }
698725
726+ public void DisableButtons ( InButtons buttons ) {
727+ AfButtonDisabled |= buttons ;
728+ }
729+
730+ public void EnableButtons ( InButtons buttons ) {
731+ AfButtonDisabled &= ~ buttons ;
732+ }
733+
699734 public bool GamePaused ;
700735
701736 public virtual void EquipSuit ( bool playEffects = false ) {
0 commit comments