/// <summary> /// Runs the script event with the given input. /// </summary> /// <param name="prio">The priority to run with.</param> /// <param name="oevt">The details of the script to be ran.</param> /// <returns>The event details after firing.</returns> public void Run(int prio, PlayerShootEventArgs oevt) { PlayerShootScriptEvent evt = (PlayerShootScriptEvent)Duplicate(); evt.Cancelled = oevt.Cancelled; evt.Player = oevt.Player; evt.Gun = oevt.Gun; evt.Call(prio); oevt.Gun = evt.Gun; oevt.Cancelled = evt.Cancelled; }
public static bool PlayerShoot(Player player, UseableGun gun) { PlayerShootEventArgs evt = new PlayerShootEventArgs(); evt.Player = new PlayerTag(player.channel.owner); // TODO: make GunTag/WeaponTag/EquipmentTag/WhateverTag to store this more accurately? evt.Gun = new ItemAssetTag(player.equipment.asset); UnturnedFreneticEvents.OnPlayerShoot.Fire(evt); return evt.Cancelled; }