forked from Mirrors/openclonk
Implemented a simple Damage>HitPoints -> Destruction mechanism for structures
parent
1e65c14ec2
commit
80e1abc808
|
@ -0,0 +1,4 @@
|
|||
[DefCore]
|
||||
id=Library_Structure
|
||||
Version=5,2,2,0
|
||||
Category=C4D_StaticBack
|
Binary file not shown.
After Width: | Height: | Size: 124 B |
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
Structure Library
|
||||
Basic library for structures, handles:
|
||||
* Damage
|
||||
|
||||
@author Maikel
|
||||
*/
|
||||
|
||||
public func Damage(int change, int cause, int cause_plr)
|
||||
{
|
||||
// Safety, although this should not occur.
|
||||
if (!this)
|
||||
return _inherited(change, cause, cause_plr);
|
||||
// Only do stuff if the object has the HitPoints property.
|
||||
if (this.HitPoints == nil)
|
||||
return _inherited(change, cause, cause_plr);
|
||||
if (GetDamage() >= this.HitPoints)
|
||||
{
|
||||
// Destruction callback is made by the engine.
|
||||
return RemoveObject();
|
||||
}
|
||||
return _inherited(change, cause, cause_plr);
|
||||
}
|
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#include Library_Structure
|
||||
|
||||
local is_open;
|
||||
|
||||
protected func Construction()
|
||||
|
@ -78,3 +80,4 @@ protected func Definition(def)
|
|||
}
|
||||
|
||||
local Name = "$Name$";
|
||||
local HitPoints = 50;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*-- compensator --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_PowerProducer
|
||||
#include Library_PowerConsumer
|
||||
|
@ -205,4 +206,5 @@ local ActMap = {
|
|||
},
|
||||
};
|
||||
local BlastIncinerate = 1;
|
||||
local HitPoints = 25;
|
||||
local ContactIncinerate = 1;
|
|
@ -1,5 +1,6 @@
|
|||
/*-- Elevator case --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_PowerConsumer
|
||||
|
||||
local elevator;
|
||||
|
@ -421,4 +422,5 @@ local Name = "$Name$";
|
|||
local Description = "$Description$";
|
||||
local Touchable = 2;
|
||||
local Speed = 15;
|
||||
local RushSpeed = 20; // When moving on its own
|
||||
local RushSpeed = 20; // When moving on its own
|
||||
local HitPoints = 50;
|
|
@ -1,5 +1,6 @@
|
|||
/*-- Elevator --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
|
||||
local case, rope;
|
||||
|
@ -162,4 +163,5 @@ func Definition(def) {
|
|||
}
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local BlastIncinerate = 100;
|
||||
local BlastIncinerate = 100;
|
||||
local HitPoints = 70;
|
|
@ -1,5 +1,6 @@
|
|||
/*-- Flagpole --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Flag
|
||||
#include Library_GoldSeller
|
||||
#include Library_Base // Needed for DuBuy...
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
Melts iron ore to metal, using some sort of fuel.
|
||||
--*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_Producer
|
||||
|
||||
|
@ -140,3 +141,4 @@ func Definition(def) {
|
|||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local BlastIncinerate = 100;
|
||||
local HitPoints = 100;
|
|
@ -5,6 +5,7 @@
|
|||
Pumps liquids using drain and source pipes.
|
||||
--*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_PowerConsumer
|
||||
|
||||
|
@ -169,6 +170,7 @@ public func SetPumpableMaterials(string to_val)
|
|||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local BlastIncinerate = 50;
|
||||
local HitPoints = 70;
|
||||
local ActMap = {
|
||||
Pump = {
|
||||
Prototype = Action,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
Cuts trees or other objects into wood. Accepts only objects purely made from wood.
|
||||
--*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_Producer
|
||||
|
||||
|
@ -207,4 +208,5 @@ func Definition(def) {
|
|||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local SpinStep = 30;
|
||||
local BlastIncinerate = 100;
|
||||
local BlastIncinerate = 100;
|
||||
local HitPoints = 70;
|
|
@ -1,5 +1,6 @@
|
|||
/*-- Steam engine --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_PowerProducer
|
||||
|
||||
|
@ -164,5 +165,6 @@ func Definition(def) {
|
|||
SetProperty("MeshTransformation", Trans_Mul(Trans_Rotate(25,0,1,0), Trans_Scale(625)), def);
|
||||
}
|
||||
local BlastIncinerate = 130;
|
||||
local HitPoints = 100;
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
|
@ -1,5 +1,6 @@
|
|||
/*-- Tools workshop --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_Producer
|
||||
|
||||
|
@ -104,4 +105,5 @@ func Definition(def) {
|
|||
}
|
||||
local Name = "$Name$";
|
||||
local Description ="$Description$";
|
||||
local BlastIncinerate = 100;
|
||||
local BlastIncinerate = 100;
|
||||
local HitPoints = 70;
|
|
@ -1,5 +1,6 @@
|
|||
/*-- Wind generator --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_PowerProducer
|
||||
|
||||
|
@ -80,3 +81,4 @@ local Name = "$Name$";
|
|||
local Description = "$Description$";
|
||||
local BlastIncinerate = 60;
|
||||
local ContactIncinerate = 5;
|
||||
local HitPoints = 50;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
Crushes seeds into flour using power - is an own power producer too
|
||||
--*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_Producer
|
||||
#include Library_PowerConsumer
|
||||
|
@ -154,5 +155,6 @@ func Definition(def) {
|
|||
SetProperty("PictureTransformation", Trans_Mul(Trans_Translate(2000,0,7000),Trans_Rotate(-20,1,0,0),Trans_Rotate(30,0,1,0)), def);
|
||||
}
|
||||
local BlastIncinerate = 100;
|
||||
local HitPoints = 70;
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*-- Wooden Cabin --*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
#include Library_DoorControl
|
||||
|
||||
|
@ -62,5 +63,6 @@ func Definition(def) {
|
|||
SetProperty("MeshTransformation", Trans_Rotate(-8,0,1,0));
|
||||
}
|
||||
local BlastIncinerate = 100;
|
||||
local HitPoints = 70;
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
Loading…
Reference in New Issue