Skip to content

Commit

Permalink
2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
IkaOverride committed Oct 29, 2023
1 parent 5364bb3 commit beb27fc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 44 deletions.
83 changes: 40 additions & 43 deletions ShootingInteractions/EventsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void OnShooting(ShootingEventArgs args) {
chamber.SetDoor(!chamber.IsOpen, locker._grantedBeep);

// Refresh opened syncvar
locker.RefreshOpenedSyncvar();
locker.RefreshOpenedSyncvar();
}

// Elevators (If there's an ElevatorPanel in the GameObject)
Expand Down Expand Up @@ -215,64 +215,61 @@ public void OnShooting(ShootingEventArgs args) {
// Grenades (If there's a TimedGrenadePickup in the GameObject)
else if (gameObject.GetComponentInParent<TimedGrenadePickup>() is TimedGrenadePickup grenadePickup) {

// Get the exiled pickup associated to the basegame pickup
Pickup pickup = Pickup.Get(grenadePickup);

// If the grenade is a custom item
if (CustomItem.TryGet(pickup, out CustomItem customItem) && Config.CustomGrenades.IsEnabled) {
// Custom grenades
if (CustomItem.TryGet(pickup, out CustomItem customItem)) {

// If we can spawn a pickup based on the custom item.
if (CustomItem.TrySpawn(customItem.Id, grenadePickup.Position, out Pickup customPickup)) {

// Cast to a grenade pickup
TimedGrenadePickup customGrenadePickup = (TimedGrenadePickup) customPickup.Base;
// Return if custom grenades aren't enabled
if (!Config.CustomGrenades.IsEnabled)
return;

// Set the attacker to the player shooting
customGrenadePickup._attacker = args.Player.Footprint;
// Set the attacker to the player shooting
grenadePickup._attacker = args.Player.Footprint;

// Explode the custom grenade
customGrenadePickup._replaceNextFrame = true;
// Explode the custom grenade
grenadePickup._replaceNextFrame = true;
}

// Normal grenades
else {

// Destroy the original pickup
Object.Destroy(grenadePickup.gameObject);
}

return;
}
// Create a new grenade
Item item = Item.Create(pickup.Info.ItemId);

// Create a new grenade
Item item = Item.Create(pickup.Info.ItemId);
// If the grenade is a frag grenade and it is enabled in the config
if (item is ExplosiveGrenade explosiveGrenade && Config.FragGrenades.IsEnabled) {

// If the grenade is a frag grenade and it is enabled in the config
if (item is ExplosiveGrenade explosiveGrenade && Config.FragGrenades.IsEnabled) {
// Explode the frag grenade instantly if it is set in the config
if (Config.FragGrenades.ExplodeInstantly)
explosiveGrenade.FuseTime = 0.1f;

// Explode the frag grenade instantly if it is set in the config
if (Config.FragGrenades.ExplodeInstantly)
explosiveGrenade.FuseTime = 0.1f;
// Spawn the frag grenade to the position of the pickup with the player as the owner and activate it
explosiveGrenade.SpawnActive(grenadePickup.Position, args.Player);

// Spawn the frag grenade to the position of the pickup with the player as the owner and activate it
explosiveGrenade.SpawnActive(grenadePickup.Position, args.Player);
// Destroy the pickup
Object.Destroy(grenadePickup.gameObject);
}

// Destroy the pickup
Object.Destroy(grenadePickup.gameObject);
}
// If the grenade is a flashbang and it is enabled in config
else if (item is FlashGrenade flashGrenade && Config.Flashbangs.IsEnabled) {

// If the grenade is a flashbang and it is enabled in config
else if (item is FlashGrenade flashGrenade && Config.Flashbangs.IsEnabled) {
// Explode the flashbang instantly if it is set in the config
if (Config.Flashbangs.ExplodeInstantly)
flashGrenade.FuseTime = 0.1f;

// Explode the flashbang instantly if it is set in the config
if (Config.Flashbangs.ExplodeInstantly)
flashGrenade.FuseTime = 0.1f;
// Spawn the flashbang to the position of the pickup with the player as the owner and activate it
flashGrenade.SpawnActive(grenadePickup.Position, args.Player);

// Spawn the flashbang to the position of the pickup with the player as the owner and activate it
flashGrenade.SpawnActive(grenadePickup.Position, args.Player);
// Destroy the pickup
Object.Destroy(grenadePickup.gameObject);
}

// Destroy the pickup
Object.Destroy(grenadePickup.gameObject);
// If the grenade isn't enabled in the config, destroy the newly created grenade
else
Object.Destroy(item.Base.gameObject);
}

// If the grenade isn't enabled in the config, destroy the newly created grenade
else
Object.Destroy(item.Base.gameObject);
}

// SCP-2176 (If there's a Scp2176Projectile in the GameObject): immediately shatter the SCP-2176
Expand Down
2 changes: 1 addition & 1 deletion ShootingInteractions/ShootingInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ShootingInteractions : Plugin<Config> {

public override Version RequiredExiledVersion => new(8, 3, 5);

public override Version Version => new(2, 1, 0);
public override Version Version => new(2, 1, 1);

private EventsHandler eventsHandler;

Expand Down

0 comments on commit beb27fc

Please sign in to comment.