-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from TORISOUP/add_speed_max
SpeedMax!
- Loading branch information
Showing
7 changed files
with
260 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
using GTA; | ||
using UniRx; | ||
|
||
namespace Inferno | ||
{ | ||
internal class ArmorAndHealthSupplier : InfernoScript | ||
using UniRx; | ||
|
||
namespace Inferno | ||
{ | ||
internal class ArmorAndHealthSupplier : InfernoScript | ||
{ | ||
protected override void Setup() | ||
protected override void Setup() | ||
{ | ||
CreateInputKeywordAsObservable("armor") | ||
.Subscribe(_ => | ||
{ | ||
IsActive = !IsActive; | ||
DrawText("SupplyArmorAndHealth:" + IsActive, 3.0f); | ||
}); | ||
|
||
OnAllOnCommandObservable.Subscribe(_ => IsActive = true); | ||
|
||
//ミッションが始まった時 | ||
OnTickAsObservable | ||
.Where(_ => IsActive) | ||
.Select(_ => Game.MissionFlag) | ||
.DistinctUntilChanged() | ||
.Where(x => x) | ||
.Subscribe(_ => SupplyArmorAndHealth()); | ||
|
||
//プレイヤが復活した時 | ||
OnTickAsObservable | ||
.Where(_ => IsActive && PlayerPed.IsSafeExist()) | ||
.Select(_ => PlayerPed.IsAlive) | ||
.DistinctUntilChanged() | ||
.Skip(1) //ONにした直後の判定結果は無視 | ||
.Where(x => x) | ||
.Subscribe(_ => SupplyArmorAndHealth()); | ||
CreateInputKeywordAsObservable("armor") | ||
.Subscribe(_ => | ||
{ | ||
IsActive = !IsActive; | ||
DrawText("SupplyArmorAndHealth:" + IsActive, 3.0f); | ||
}); | ||
|
||
OnAllOnCommandObservable.Subscribe(_ => IsActive = true); | ||
|
||
//ミッションが始まった時 | ||
OnTickAsObservable | ||
.Where(_ => IsActive) | ||
.Select(_ => Game.MissionFlag) | ||
.DistinctUntilChanged() | ||
.Where(x => x) | ||
.Subscribe(_ => SupplyArmorAndHealth()); | ||
|
||
//プレイヤが復活した時 | ||
OnTickAsObservable | ||
.Where(_ => IsActive && PlayerPed.IsSafeExist()) | ||
.Select(_ => PlayerPed.IsAlive) | ||
.DistinctUntilChanged() | ||
.Skip(1) //ONにした直後の判定結果は無視 | ||
.Where(x => x) | ||
.Subscribe(_ => SupplyArmorAndHealth()); | ||
} | ||
|
||
/// <summary> | ||
/// 体力とアーマー回復 | ||
/// </summary> | ||
private void SupplyArmorAndHealth() | ||
{ | ||
var player = PlayerPed; | ||
var maxHealth = player.MaxHealth; | ||
var maxArmor = Game.Player.GetPlayerMaxArmor(); | ||
player.Health = maxHealth; | ||
player.Armor = maxArmor; | ||
} | ||
} | ||
} | ||
/// <summary> | ||
/// 体力とアーマー回復 | ||
/// </summary> | ||
private void SupplyArmorAndHealth() | ||
{ | ||
var player = PlayerPed; | ||
var maxHealth = player.MaxHealth; | ||
var maxArmor = Game.Player.GetPlayerMaxArmor(); | ||
player.Health = maxHealth; | ||
player.Armor = maxArmor; | ||
} | ||
} | ||
} |
Oops, something went wrong.