Skip to content

Commit

Permalink
mod aint dead (yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
lempamo committed Aug 3, 2020
1 parent 31490a5 commit a25ec76
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 19 additions & 13 deletions ChaosMain.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO.Pipes;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -100,6 +102,11 @@ public class ChaosMain : Script {
bool isHUDless = false;
int lagTicks = 0;

bool twitchVoting = false;
NamedPipeServerStream twitchPipe = new NamedPipeServerStream("twitch-chaosiv-pipe", PipeDirection.InOut, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous);
byte[] twitchBuffer;
List<Effect> twitchEffectTrio = new List<Effect>(3);

public ChaosMain() {
Interval = 16;
Tick += new EventHandler(ChaosLoop);
Expand Down Expand Up @@ -127,7 +134,6 @@ public ChaosMain() {

Effects.Add(new Effect("Earthquake", EffectMiscEarthquake, new Timer(28000), EffectMiscEarthquake, EffectMiscEarthquake));
Effects.Add(new Effect("Invert Current Velocity", EffectMiscInvertVelocity));
//Effects.Add(new Effect("Zero Gravity", EffectMiscNoGravity, new Timer(28000), null, EffectMiscNormalGravity)); //this one doesn't affect vehicles :/
Effects.Add(new Effect("No HUD", EffectMiscNoHUD, new Timer(88000), null, EffectMiscShowHUD));
Effects.Add(new Effect("Nothing", EffectMiscNothing));
Effects.Add(new Effect("Spawn Jet", EffectMiscSpawnJet));
Expand Down Expand Up @@ -230,6 +236,17 @@ public ChaosMain() {
Effects.Add(new Effect("Sunny Weather", EffectWeatherSunny));
Effects.Add(new Effect("Stormy Weather", EffectWeatherThunder));


// Settings Time
var dE = Settings.GetValueString("disabledEffects").Split(',');

if (dE[0] != "")
foreach (string e in dE) {
Effects.Remove(Effects.Find(x => x.Name == e));
Game.Console.Print("Disabled effect \"" + e + "\".");
}


EffectTimer = new Timer();
EffectTimer.Tick += new EventHandler(DeployEffect);
EffectTimer.Interval = 30000;
Expand Down Expand Up @@ -370,23 +387,12 @@ public void EffectMiscInvertVelocity() {
}
}

public void EffectMiscNoGravity() {
// floating free...
// one, two, three...
// eternity....
World.GravityEnabled = false;
}

public void EffectMiscNoHUD() {
isHUDless = true;
Function.Call("DISPLAY_HUD", false);
Function.Call("DISPLAY_RADAR", false);
}

public void EffectMiscNormalGravity() {
World.GravityEnabled = true;
}

public void EffectMiscNothing() {
Game.Console.Print("ok maybe not quite \"nothing\" but eh who cares");
}
Expand Down Expand Up @@ -587,7 +593,7 @@ public void EffectPedsOHKO() {
p.Health = 5;
p.Armor = 0;
}
if (p == Player) {
if (p == Player && p.Health > 5) {
p.Health = 1;
p.Armor = 0;
}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*ChaosIV* is a Chaos mod for Grand Theft Auto IV inspired by similar mods for GTA V and GTA:SA.
The mod has been tested to work with 1.0.4.0 and 1.0.7.0, though it may likely also work with 1.0.8.0 and the Complete Edition.

A list of implemented effects can be found here: https://docs.google.com/spreadsheets/d/16mKSpQb9KH387viPWK97ejFQ6xchB1lvvpeXNYW66rI/edit?usp=sharing

This mod requires an ASI loader and .NET ScriptHook in order to be installed.
To install, simply drop the ChaosIV.net.dll file into the scripts folder within your GTA IV installation.

Expand Down

0 comments on commit a25ec76

Please sign in to comment.