-
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.
- Loading branch information
Showing
5 changed files
with
130 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using GTA; | ||
using UniRx; | ||
|
||
namespace Inferno.InfernoScripts.Parupunte.Scripts | ||
{ | ||
class PerfectFreeze : ParupunteScript | ||
{ | ||
public PerfectFreeze(ParupunteCore core) : base(core) | ||
{ | ||
} | ||
|
||
private HashSet<Entity> freezedEntities = new HashSet<Entity>(); | ||
|
||
public override string Name { get; } = "パーフェクトフリーズ"; | ||
public override string EndMessage { get; } = "おわり"; | ||
private readonly float FreezeRange = 30; | ||
|
||
public override void OnStart() | ||
{ | ||
ReduceCounter = new ReduceCounter(20 * 1000); | ||
AddProgressBar(ReduceCounter); | ||
ReduceCounter.OnFinishedAsync.Subscribe(_ => | ||
{ | ||
ParupunteEnd(); | ||
}); | ||
|
||
this.OnUpdateAsObservable | ||
.Subscribe(_ => | ||
{ | ||
var playerPos = core.PlayerPed.Position; | ||
var playerVehicle = core.GetPlayerVehicle(); | ||
|
||
#region Vehicle | ||
foreach (var v in core.CachedVehicles.Where( | ||
x => x.IsSafeExist() | ||
&& !freezedEntities.Contains(x) | ||
&& x.IsInRangeOf(playerPos, FreezeRange) | ||
&& x.IsAlive | ||
&& x != playerVehicle)) | ||
{ | ||
v.FreezePosition = true; | ||
freezedEntities.Add(v); | ||
} | ||
#endregion | ||
|
||
#region props | ||
var props = GTA.World.GetAllProps(); | ||
foreach (var prop in props.Where(x => | ||
x.IsSafeExist() | ||
&& !freezedEntities.Contains(x) | ||
&& x.IsInRangeOf(playerPos, FreezeRange) | ||
)) | ||
{ | ||
prop.FreezePosition = true; | ||
freezedEntities.Add(prop); | ||
} | ||
#endregion | ||
|
||
//離れていたら解除 | ||
var deleteTargets = freezedEntities.FirstOrDefault(x => | ||
x.IsSafeExist() && !x.IsInRangeOf(playerPos, FreezeRange + 5)); | ||
|
||
if (deleteTargets != null) | ||
{ | ||
deleteTargets.FreezePosition = false; | ||
freezedEntities.Remove(deleteTargets); | ||
} | ||
|
||
}); | ||
|
||
//プレイヤ車両は除外 | ||
core.PlayerVehicle.Where(x => x.IsSafeExist()) | ||
.Subscribe(x => x.FreezePosition = false); | ||
|
||
//終了時に全て解除 | ||
this.OnFinishedAsObservable | ||
.Subscribe(_ => | ||
{ | ||
foreach (var x in freezedEntities.Where(x => x.IsSafeExist())) | ||
{ | ||
x.FreezePosition = false; | ||
} | ||
}); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Inferno/InfernoScripts/Parupunte/Scripts/VehicleSpeedUp.cs
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using GTA.Math; | ||
using GTA.Native; | ||
using System.Linq; | ||
using UniRx; | ||
|
||
namespace Inferno.InfernoScripts.Parupunte.Scripts | ||
{ | ||
internal class VehicleSpeedUp : ParupunteScript | ||
{ | ||
public VehicleSpeedUp(ParupunteCore core) : base(core) | ||
{ | ||
} | ||
|
||
public override string Name { get; } = "エンジンパワーアップ"; | ||
|
||
public override void OnSetUp() | ||
{ | ||
} | ||
|
||
public override void OnStart() | ||
{ | ||
foreach (var v in core.CachedVehicles.Where( | ||
x => x.IsSafeExist() && x.IsAlive)) | ||
{ | ||
v.EnginePowerMultiplier = 200.0f; | ||
v.EngineTorqueMultiplier = 200.0f; | ||
} | ||
|
||
ParupunteEnd(); | ||
} | ||
} | ||
} |