forked from Mirrors/openclonk
Cannon, Catapult, Lorry: use Library_Destructible (cannons and catapults are now destructible!).
parent
5193f99d6c
commit
b1902355f9
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
|
@ -21,3 +21,17 @@ material Cannon
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
material Cannon_Damaged : Cannon
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
texture_unit
|
||||
{
|
||||
texture CannonDamaged.png
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include Library_HasExtraSlot
|
||||
#include Library_ElevatorControl
|
||||
#include Library_Destructible
|
||||
|
||||
local animAim;
|
||||
local animTurn;
|
||||
|
@ -299,4 +300,5 @@ local Description = "$Description$";
|
|||
local Touchable = 1;
|
||||
local BorderBound = C4D_Border_Sides;
|
||||
local ContactCalls = true;
|
||||
local Components = {Metal = 4, Wood = 2};
|
||||
local Components = {Metal = 4, Wood = 2};
|
||||
local HitPoints = 150;
|
Binary file not shown.
After Width: | Height: | Size: 241 KiB |
|
@ -41,3 +41,16 @@ material Catapult
|
|||
}
|
||||
}
|
||||
}
|
||||
material Catapult_Damaged : Catapult
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
texture_unit
|
||||
{
|
||||
texture CatapultDamaged.png
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include Library_ElevatorControl
|
||||
#include Library_Destructible
|
||||
|
||||
local aim_anim;
|
||||
local turn_anim;
|
||||
|
@ -357,7 +358,6 @@ private func GetSpawnInfoString(proplist enemy_data)
|
|||
return Format("{{Catapult}}%s", EnemySpawn->GetAICreatureInfoString(enemy_data.Gunner));
|
||||
}
|
||||
|
||||
|
||||
/* Properties */
|
||||
|
||||
local Name = "$Name$";
|
||||
|
@ -366,6 +366,7 @@ local Touchable = 1;
|
|||
local BorderBound = C4D_Border_Sides;
|
||||
local ContactCalls = true;
|
||||
local Components = {Metal = 1, Wood = 6};
|
||||
local HitPoints = 100;
|
||||
|
||||
local ActMap = {
|
||||
Roll = {
|
||||
|
|
|
@ -18,3 +18,16 @@ material Lorry
|
|||
}
|
||||
}
|
||||
}
|
||||
material Lorry_Damaged
|
||||
{
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
texture_unit
|
||||
{
|
||||
texture lorryDamaged.jpg
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include Library_ElevatorControl
|
||||
#include Library_Destructible
|
||||
|
||||
local drive_anim;
|
||||
local tremble_anim;
|
||||
|
@ -235,53 +236,46 @@ public func TurnWheels()
|
|||
}
|
||||
}
|
||||
|
||||
protected func Damage(int change, int cause, int by_player)
|
||||
// Custom fragments
|
||||
func OnDestruction(int change, int cause, int by_player)
|
||||
{
|
||||
// Only explode the lorry on blast damage.
|
||||
if (cause != FX_Call_DmgBlast)
|
||||
return _inherited(change, cause, by_player, ...);
|
||||
// Explode the lorry when it has taken to much damage.
|
||||
if (GetDamage() > 100)
|
||||
// Only exit objects and parts if this lorry is not contained.
|
||||
if (!Contained())
|
||||
{
|
||||
// Only exit objects and parts if this lorry is not contained.
|
||||
if (!Contained())
|
||||
// First eject the contents in different directions.
|
||||
for (var obj in FindObjects(Find_Container(this)))
|
||||
{
|
||||
// First eject the contents in different directions.
|
||||
for (var obj in FindObjects(Find_Container(this)))
|
||||
{
|
||||
var speed = RandomX(3, 5);
|
||||
var angle = Random(360);
|
||||
var dx = Cos(angle, speed);
|
||||
var dy = Sin(angle, speed);
|
||||
obj->Exit(RandomX(-4, 4), RandomX(-4, 4), Random(360), dx, dy, RandomX(-20, 20));
|
||||
obj->SetController(by_player);
|
||||
}
|
||||
|
||||
// Toss around some fragments with particles attached.
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
var fragment = CreateObject(LorryFragment, RandomX(-4, 4), RandomX(-4, 4), GetOwner());
|
||||
var speed = RandomX(40, 60);
|
||||
var angle = Random(360);
|
||||
var dx = Cos(angle, speed);
|
||||
var dy = Sin(angle, speed);
|
||||
fragment->SetXDir(dx, 10);
|
||||
fragment->SetYDir(dy, 10);
|
||||
fragment->SetR(360);
|
||||
fragment->SetRDir(RandomX(-20, 20));
|
||||
// Set the controller of the fragments to the one causing the blast for kill tracing.
|
||||
fragment->SetController(by_player);
|
||||
// Incinerate the fragments.
|
||||
fragment->Incinerate(100, by_player);
|
||||
}
|
||||
var speed = RandomX(3, 5);
|
||||
var angle = Random(360);
|
||||
var dx = Cos(angle, speed);
|
||||
var dy = Sin(angle, speed);
|
||||
obj->Exit(RandomX(-4, 4), RandomX(-4, 4), Random(360), dx, dy, RandomX(-20, 20));
|
||||
obj->SetController(by_player);
|
||||
}
|
||||
// Remove the lorry itself, eject possible contents as they might have entered again.
|
||||
// Or let the engine eject the contents if it is inside a container.
|
||||
return RemoveObject(true);
|
||||
}
|
||||
return _inherited(change, cause, by_player, ...);
|
||||
}
|
||||
|
||||
// Toss around some fragments with particles attached.
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
var fragment = CreateObject(LorryFragment, RandomX(-4, 4), RandomX(-4, 4), GetOwner());
|
||||
var speed = RandomX(40, 60);
|
||||
var angle = Random(360);
|
||||
var dx = Cos(angle, speed);
|
||||
var dy = Sin(angle, speed);
|
||||
fragment->SetXDir(dx, 10);
|
||||
fragment->SetYDir(dy, 10);
|
||||
fragment->SetR(360);
|
||||
fragment->SetRDir(RandomX(-20, 20));
|
||||
// Set the controller of the fragments to the one causing the blast for kill tracing.
|
||||
fragment->SetController(by_player);
|
||||
// Incinerate the fragments.
|
||||
fragment->Incinerate(100, by_player);
|
||||
}
|
||||
}
|
||||
// Remove the lorry itself, eject possible contents as they might have entered again.
|
||||
// Or let the engine eject the contents if it is inside a container.
|
||||
RemoveObject(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-- Properties --*/
|
||||
|
||||
|
@ -314,3 +308,4 @@ local Touchable = 1;
|
|||
local BorderBound = C4D_Border_Sides;
|
||||
local ContactCalls = true;
|
||||
local Components = {Metal = 2, Wood = 1};
|
||||
local HitPoints = 100;
|
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
|
@ -7,4 +7,5 @@ public func Construction()
|
|||
{
|
||||
_inherited(...);
|
||||
SetMeshMaterial("GoldenCannon", 0);
|
||||
MakeInvincible();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue