function R1911Switch1(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 1; end end function R1911Switch2(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 2; end end function Create(self) self.weaponNameTable = {"R1911 Extended Magazine", "R1911 Extended Magazine Alt Fire"}; self.weaponClassTable = {"HDFirearm", "HDFirearm"}; self.switchPhase = 0; self.switchTimer = Timer(); self.flipTimer = false; self.switchDelay = 2000; -- This is the time delay self.BurstTimer = Timer() end function Update(self) if self.Sharpness ~= 0 then local actor = MovableMan:GetMOFromID(self.RootID); if MovableMan:IsActor(actor) then self.parent = ToAHuman(actor); end if self.flipTimer == false then self.flipTimer = true; self.switchTimer:Reset(); end if self.switchTimer:IsPastSimMS(self.switchDelay) then if self.switchPhase == 0 then if MovableMan:IsActor(self.parent) then if self.weaponClassTable[self.Sharpness] == "HDFirearm" then local switchGun = ToActor(self.parent):AddInventoryItem(CreateHDFirearm(self.weaponNameTable[self.Sharpness])); elseif self.weaponClassTable[self.Sharpness] == "TDExplosive" then local switchGun = ToActor(self.parent):AddInventoryItem(CreateTDExplosive(self.weaponNameTable[self.Sharpness])); elseif self.weaponClassTable[self.Sharpness] == "HeldDevice" then local switchGun = ToActor(self.parent):AddInventoryItem(CreateHeldDevice(self.weaponNameTable[self.Sharpness])); end ToActor(self.parent):GetController():SetState(Controller.WEAPON_DROP,true); self.switchPhase = 1; else self.Sharpness = 0; end else if MovableMan:IsActor(self.parent) then if ToActor(self.parent):IsInventoryEmpty() == false then ToActor(self.parent):GetController():SetState(Controller.WEAPON_CHANGE_PREV,true); end end self.ToDelete = true; end else if MovableMan:IsActor(self.parent) then ToActor(self.parent):GetController():SetState(Controller.WEAPON_FIRE,false); end end end if self:IsActivated() and self.Magazine then if not self.burst then self.burst = self.Magazine.RoundCount self.BurstTimer:Reset() elseif self.burst - 3 >= self.Magazine.RoundCount then self:Deactivate() -- one three round burst fired, stop shooting if self.BurstTimer:IsPastSimMS(400) then self.burst = nil end end else self.burst = nil end end