Skip to content

Commit

Permalink
Merge pull request #36 from destoer/dev
Browse files Browse the repository at this point in the history
add block config, fix high speed knife, show option in lr print
  • Loading branch information
destoer authored Apr 10, 2024
2 parents 5a68074 + a977b4e commit 134cac4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/Jail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class JailConfig : BasePluginConfig
[JsonPropertyName("database")]
public String database { get; set; } = "cs2_jail";

[JsonPropertyName("no_block")]
public bool noBlock { get; set; } = true;

[JsonPropertyName("mute_dead")]
public bool muteDead { get; set; } = true;

Expand Down Expand Up @@ -268,6 +271,7 @@ public void OnConfigParsed(JailConfig config)
warden.Config = config;
warden.mute.Config = config;
warden.warday.Config = config;
warden.block.Config = config;
JailPlayer.Config = config;

sd.Config = config;
Expand Down
13 changes: 11 additions & 2 deletions src/LastRequest/LRBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,17 @@ static public void PrintCountdown(LRBase lr, int delay)
return;
}

tPlayer.PrintToCenter($"Starting {lr.lrName} against {ctPlayer.PlayerName} in {delay} seconds");
ctPlayer.PrintToCenter($"Starting {lr.lrName} against {tPlayer.PlayerName} in {delay} seconds");
if(lr.choice == "")
{
tPlayer.PrintToCenter($"Starting {lr.lrName} against {ctPlayer.PlayerName} in {delay} seconds");
ctPlayer.PrintToCenter($"Starting {lr.lrName} against {tPlayer.PlayerName} in {delay} seconds");
}

else
{
tPlayer.PrintToCenter($"Starting {lr.lrName} ({lr.choice}) against {ctPlayer.PlayerName} in {delay} seconds");
ctPlayer.PrintToCenter($"Starting {lr.lrName} ({lr.choice}) against {tPlayer.PlayerName} in {delay} seconds");
}
}

public void CountdownStart()
Expand Down
11 changes: 11 additions & 0 deletions src/LastRequest/LRKnife.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,15 @@ public override void InitPlayer(CCSPlayerController player)
}
}
}

public override void PlayerHurt(int health,int damage, int hitgroup)
{
CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot);

// re init the player
if(choice == "High speed" && player.IsLegalAlive())
{
player.SetVelocity(2.5f);
}
}
}
16 changes: 12 additions & 4 deletions src/LastRequest/LastRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void CreateLRSlots(uint slots)
}
}

void InitPlayerCommon(CCSPlayerController? player, String lrName)
void InitPlayerCommon(CCSPlayerController? player, String lrName, String option)
{
if(!player.IsLegalAlive())
{
Expand All @@ -58,7 +58,15 @@ void InitPlayerCommon(CCSPlayerController? player, String lrName)
player.StripWeapons(true);
player.GiveArmour();

player.Announce(LR_PREFIX,$"{lrName} is starting\n");
if(option == "")
{
player.Announce(LR_PREFIX,$"{lrName} is starting\n");
}

else
{
player.Announce(LR_PREFIX,$"{lrName} ({option}) is starting\n");
}
}

bool LRExists(LRBase lr)
Expand Down Expand Up @@ -234,8 +242,8 @@ void InitLR(LRChoice choice)
}

// do common player setup
InitPlayerCommon(tPlayer,tLR.lrName);
InitPlayerCommon(ctPlayer,ctLR.lrName);
InitPlayerCommon(tPlayer,tLR.lrName,choice.option);
InitPlayerCommon(ctPlayer,ctLR.lrName,choice.option);

// bind lr pair
tLR.partner = ctLR;
Expand Down
14 changes: 11 additions & 3 deletions src/Warden/Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,18 @@ public void UnBlockAll()

public void RoundStart()
{
// TODO: for now we just assume no block
// we wont have a cvar
UnBlockAll();
if(Config.noBlock)
{
UnBlockAll();
}

else
{
BlockAll();
}
}

public JailConfig Config = new JailConfig();

bool blockState = false;
}

0 comments on commit 134cac4

Please sign in to comment.