function FranchiSPAS12SwitchOne(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 1; end end function FranchiSPAS12SwitchTwo(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 2; end end function FranchiSPAS12SwitchThree(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 3; end end function FranchiSPAS12SwitchFour(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 4; end end function FranchiSPAS12SwitchFive(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 5; end end function FranchiSPAS12SwitchSix(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 6; end end function FranchiSPAS12SwitchSeven(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 7; end end function FranchiSPAS12SwitchEight(actor) local gun = ToAHuman(actor).EquippedItem; if gun ~= nil then gun.Sharpness = 8; end end function Create(self) self.weaponNameTable = {"Franchi SPAS-12 (Buckshot)","Franchi SPAS-12 (Dragon's Breath)","Franchi SPAS-12 (Slug)","Franchi SPAS-12 (Frag-12)","Franchi SPAS-12 (Sabot)","Franchi SPAS-12 (Rubber Buckshot)","Franchi SPAS-12 (Door Breach)","Franchi SPAS-12 (Melee)"}; self.weaponClassTable = {"HDFirearm","HDFirearm","HDFirearm","HDFirearm","HDFirearm","HDFirearm","HDFirearm","HDFirearm"}; self.switchPhase = 0; self.switchTimer = Timer(); self.flipTimer = false; self.switchDelay = 2000; self.reloadTimer = Timer(); self.loadedShell = false; self.reloadCycle = false; self.reloadDelay = 200; if self.Magazine then self.ammoCounter = self.Magazine.RoundCount; else self.ammoCounter = 0; end 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.Magazine ~= nil then if self.loadedShell == false then self.ammoCounter = self.Magazine.RoundCount; else self.loadedShell = false; self.Magazine.RoundCount = self.ammoCounter + 1; end else self.reloadTimer:Reset(); self.reloadCycle = true; self.loadedShell = true; end if self:IsActivated() then self.reloadCycle = false; end if self.reloadCycle == true and self.reloadTimer:IsPastSimMS(self.reloadDelay) and self:IsFull() == false then local actor = MovableMan:GetMOFromID(self.RootID); if MovableMan:IsActor(actor) then ToActor(actor):GetController():SetState(Controller.WEAPON_RELOAD,true); end self.reloadCycle = false; end end