2012-07-16 13:29:49 +00:00
|
|
|
/*-- Shipyard --*/
|
|
|
|
|
|
|
|
#include Library_Structure
|
|
|
|
#include Library_Ownable
|
|
|
|
#include Library_Producer
|
2015-07-18 11:14:31 +00:00
|
|
|
#include Library_LampPost
|
2012-07-16 13:29:49 +00:00
|
|
|
|
2012-08-07 18:57:01 +00:00
|
|
|
local animWork;
|
|
|
|
local meshAttach;
|
|
|
|
|
2015-07-18 11:14:31 +00:00
|
|
|
public func LampPosition(id def) { return [GetCalcDir()*-6,30]; }
|
2015-07-02 20:36:02 +00:00
|
|
|
|
2012-08-07 18:57:01 +00:00
|
|
|
func Initialize()
|
|
|
|
{
|
2016-01-29 04:47:53 +00:00
|
|
|
animWork = PlayAnimation("Work", 1, Anim_Const(0));
|
2012-08-07 18:57:01 +00:00
|
|
|
return _inherited(...);
|
|
|
|
}
|
|
|
|
|
2012-07-16 13:29:49 +00:00
|
|
|
func Construction(object creator)
|
|
|
|
{
|
2012-08-07 18:57:01 +00:00
|
|
|
SetAction("Wait");
|
2012-07-16 13:29:49 +00:00
|
|
|
return _inherited(creator, ...);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-- Production --*/
|
|
|
|
|
|
|
|
public func IsProduct(id product_id)
|
|
|
|
{
|
|
|
|
return product_id->~IsShipyardProduct();
|
|
|
|
}
|
|
|
|
|
|
|
|
private func ProductionTime(id toProduce) { return 400; }
|
2015-03-09 17:40:45 +00:00
|
|
|
public func PowerNeed() { return 80; }
|
2012-07-16 13:29:49 +00:00
|
|
|
|
2012-08-07 18:57:01 +00:00
|
|
|
private func FxIntWorkAnimTimer(object target, proplist effect, int timer)
|
|
|
|
{
|
|
|
|
if(effect.paused == true) return 1;
|
|
|
|
|
|
|
|
// Message("Working...");
|
|
|
|
|
|
|
|
var tickAmount = 50;
|
|
|
|
var animSpot = GetAnimationPosition(animWork);
|
|
|
|
//-50 is to dodge around an engine crash. If it reaches (near) the end of the
|
|
|
|
//animation, it dies for some reason. :(
|
|
|
|
var animLength = GetAnimationLength("Work") - 50;
|
|
|
|
|
|
|
|
//loop anim
|
|
|
|
if(animSpot + tickAmount > animLength){
|
|
|
|
SetAnimationPosition(animWork, Anim_Const(animSpot + tickAmount - animLength));
|
|
|
|
}
|
|
|
|
//otherwise, advance animation
|
|
|
|
else SetAnimationPosition(animWork, Anim_Const(animSpot + tickAmount));
|
|
|
|
}
|
|
|
|
|
|
|
|
local workEffect;
|
|
|
|
|
|
|
|
public func OnProductionStart(id product)
|
|
|
|
{
|
|
|
|
workEffect = AddEffect("IntWorkAnim", this, 1,1,this);
|
|
|
|
return _inherited(...);
|
|
|
|
}
|
|
|
|
|
|
|
|
public func OnProductionHold(id product)
|
|
|
|
{
|
|
|
|
workEffect.paused = true;
|
|
|
|
return _inherited(...);
|
|
|
|
}
|
|
|
|
|
|
|
|
public func OnProductionContinued(id product)
|
|
|
|
{
|
|
|
|
workEffect.paused = false;
|
|
|
|
return _inherited(...);
|
|
|
|
}
|
|
|
|
|
|
|
|
public func OnProductionFinish(id product)
|
|
|
|
{
|
|
|
|
RemoveEffect(nil, this, workEffect);
|
|
|
|
return _inherited(...);
|
|
|
|
}
|
|
|
|
|
|
|
|
func Definition(def){
|
|
|
|
SetProperty("MeshTransformation", Trans_Rotate(8, 0,1,0), def);
|
|
|
|
SetProperty("PictureTransformation", Trans_Mul(Trans_Translate(0,-25000,50000), Trans_Scale(500)), def);
|
|
|
|
}
|
|
|
|
|
2012-07-16 13:29:49 +00:00
|
|
|
local ActMap = {
|
2012-08-07 18:57:01 +00:00
|
|
|
Wait = {
|
2012-07-16 13:29:49 +00:00
|
|
|
Prototype = Action,
|
2012-08-07 18:57:01 +00:00
|
|
|
Name = "Wait",
|
2012-07-16 13:29:49 +00:00
|
|
|
Procedure = DFA_NONE,
|
|
|
|
Directions = 2,
|
|
|
|
FlipDir = 1,
|
|
|
|
Length = 1,
|
|
|
|
Delay = 0,
|
|
|
|
FacetBase=1,
|
2012-08-07 18:57:01 +00:00
|
|
|
NextAction = "Wait",
|
2012-07-16 13:29:49 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
local Name = "$Name$";
|
|
|
|
local Description ="$Description$";
|
2015-01-14 19:30:55 +00:00
|
|
|
local ContainBlast = true;
|
2012-07-16 13:29:49 +00:00
|
|
|
local BlastIncinerate = 100;
|
2013-12-22 22:47:40 +00:00
|
|
|
local HitPoints = 70;
|