1 /*-- Kitchen --*/
2
3 #include Library_Structure
4 #include Library_Ownable
5 #include Library_Producer
6 #include Library_LampPost
7
8 local hold_production;
9
LanternPosition(id def)10 public func LanternPosition(id def) { return [GetCalcDir()*19,-1]; }
11
Construction(object creator)12 func Construction(object creator)
13 {
14 SetAction("Default");
15 return _inherited(creator, ...);
16 }
17
IsHammerBuildable()18 public func IsHammerBuildable() { return true; }
19
20 /*-- Production --*/
21
IsProduct(id product_id)22 func IsProduct(id product_id)
23 {
24 return product_id->~IsKitchenProduct();
25 }
26
ProductionTime(id product)27 private func ProductionTime(id product) { return _inherited(product, ...) ?? 500; }
PowerNeed()28 public func PowerNeed() { return 0; }
29
OnProductionStart(id product)30 public func OnProductionStart(id product)
31 {
32 AddEffect("Working", this, 100, 1, this);
33 hold_production = false;
34 }
35
OnProductionHold(id product)36 public func OnProductionHold(id product)
37 {
38 hold_production = true;
39 }
40
OnProductionContinued(id product)41 public func OnProductionContinued(id product)
42 {
43 hold_production = false;
44 }
45
OnProductionFinish(id product)46 public func OnProductionFinish(id product)
47 {
48 RemoveEffect("Working", this);
49 }
50
FxWorkingTimer()51 protected func FxWorkingTimer()
52 {
53 if(!hold_production)
54 Smoking();
55 }
56
Smoking()57 private func Smoking()
58 {
59 if (!Random(4)) Smoke(16 * GetCalcDir(),-14,16);
60 if (!Random(6)) Smoke(10 * GetCalcDir(),-14,15+Random(3));
61
62 //Fire
63 CreateParticle("Fire", 13 * GetCalcDir(), 16, PV_Random(-1, 1), PV_Random(-1, 1), PV_Random(18, 36), Particles_Fire(), 2);
64 }
65
66 local ActMap = {
67 Default = {
68 Prototype = Action,
69 Name = "Default",
70 Procedure = DFA_NONE,
71 Directions = 2,
72 FlipDir = 1,
73 Length = 1,
74 Delay = 0,
75 FacetBase=1,
76 NextAction = "Default",
77 },
78 };
79
80 local Name = "$Name$";
81 local Description ="$Description$";
82 local ContainBlast = true;
83 local BlastIncinerate = 100;
84 local FireproofContainer = true;
85 local HitPoints = 70;
86 local Components = {Wood = 3, Rock = 2, Metal = 1};