2011-10-06 13:02:36 +00:00
|
|
|
/*
|
|
|
|
IronBomb
|
2013-05-24 19:17:44 +00:00
|
|
|
Author: Ringwaul, Clonkonaut
|
2011-10-06 13:02:36 +00:00
|
|
|
|
2013-05-24 19:17:44 +00:00
|
|
|
Explodes after a short fuse. Explodes on contact if shot by the grenade launcher
|
2011-10-06 13:02:36 +00:00
|
|
|
*/
|
2013-05-24 19:17:44 +00:00
|
|
|
|
|
|
|
local armed; // If true, explodes on contact
|
2011-10-06 13:02:36 +00:00
|
|
|
|
2015-05-17 12:01:26 +00:00
|
|
|
public func ControlUse(object clonk, int x, int y)
|
2011-10-06 13:02:36 +00:00
|
|
|
{
|
|
|
|
// if already activated, nothing (so, throw)
|
|
|
|
if(GetEffect("FuseBurn", this))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Fuse();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-24 19:17:44 +00:00
|
|
|
func Fuse(bool explode_on_hit)
|
2011-10-06 13:02:36 +00:00
|
|
|
{
|
2013-05-24 19:17:44 +00:00
|
|
|
armed = explode_on_hit;
|
2011-10-06 13:02:36 +00:00
|
|
|
AddEffect("FuseBurn", this, 1,1, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
func FxFuseBurnTimer(object bomb, int num, int timer)
|
|
|
|
{
|
|
|
|
var i = 3;
|
|
|
|
var x = +Sin(GetR(), i);
|
|
|
|
var y = -Cos(GetR(), i);
|
2013-12-17 20:40:40 +00:00
|
|
|
CreateParticle("Smoke", x, y, x, y, PV_Random(18, 36), Particles_Smoke(), 2);
|
2011-10-06 13:02:36 +00:00
|
|
|
|
|
|
|
if(timer == 1) Sound("FuseLoop",nil,nil,nil,+1);
|
|
|
|
if(timer >= 90)
|
|
|
|
{
|
|
|
|
Sound("FuseLoop",nil,nil,nil,-1);
|
|
|
|
DoExplode();
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func DoExplode()
|
|
|
|
{
|
|
|
|
var i = 23;
|
|
|
|
while(i != 0)
|
|
|
|
{
|
2015-01-10 09:14:02 +00:00
|
|
|
var shrapnel = CreateObjectAbove(Shrapnel);
|
2011-10-06 13:02:36 +00:00
|
|
|
shrapnel->SetVelocity(Random(359), RandomX(100,140));
|
|
|
|
shrapnel->SetRDir(-30+ Random(61));
|
2012-08-07 19:00:18 +00:00
|
|
|
shrapnel->Launch(GetController());
|
2015-01-10 09:14:02 +00:00
|
|
|
CreateObjectAbove(BulletTrail)->Set(2,30,shrapnel);
|
2011-10-06 13:02:36 +00:00
|
|
|
i--;
|
|
|
|
}
|
2011-10-06 13:34:32 +00:00
|
|
|
if(GBackLiquid())
|
2011-10-12 21:09:22 +00:00
|
|
|
Sound("BlastLiquid2");
|
2011-10-06 13:34:32 +00:00
|
|
|
else
|
2011-10-12 21:09:22 +00:00
|
|
|
Sound("BlastMetal");
|
2013-12-17 20:40:40 +00:00
|
|
|
CreateParticle("Smoke", PV_Random(-30, 30), PV_Random(-30, 30), 0, 0, PV_Random(40, 60), Particles_Smoke(), 60);
|
2014-01-11 15:29:19 +00:00
|
|
|
Explode(30);
|
2011-10-06 13:02:36 +00:00
|
|
|
}
|
|
|
|
|
2015-05-17 12:01:26 +00:00
|
|
|
protected func Hit(int x, int y)
|
2011-10-08 16:12:19 +00:00
|
|
|
{
|
2013-05-24 19:17:44 +00:00
|
|
|
if (armed) return DoExplode();
|
2011-10-08 16:12:19 +00:00
|
|
|
StonyObjectHit(x,y);
|
|
|
|
}
|
2011-10-06 13:02:36 +00:00
|
|
|
|
2015-05-17 12:01:26 +00:00
|
|
|
protected func Incineration(int caused_by)
|
|
|
|
{
|
|
|
|
Extinguish();
|
|
|
|
Fuse();
|
|
|
|
SetController(caused_by);
|
|
|
|
}
|
2011-10-06 13:02:36 +00:00
|
|
|
|
|
|
|
protected func RejectEntrance()
|
|
|
|
{
|
|
|
|
return GetAction() == "Fuse" || GetAction() == "Ready";
|
|
|
|
}
|
|
|
|
|
2011-10-13 22:03:55 +00:00
|
|
|
public func IsWeapon() { return true; }
|
|
|
|
public func IsArmoryProduct() { return true; }
|
2013-05-24 19:17:44 +00:00
|
|
|
public func IsGrenadeLauncherAmmo() { return true; }
|
2011-10-13 22:03:55 +00:00
|
|
|
|
2011-10-06 13:02:36 +00:00
|
|
|
local Name = "$Name$";
|
|
|
|
local Description = "$Description$";
|
2012-03-28 19:14:58 +00:00
|
|
|
local UsageHelp = "$UsageHelp$";
|
2011-10-06 13:02:36 +00:00
|
|
|
local Collectible = 1;
|
|
|
|
local Rebuy = true;
|
2012-04-28 14:17:38 +00:00
|
|
|
local BlastIncinerate = 1;
|
|
|
|
local ContactIncinerate = 1;
|