forked from Mirrors/openclonk
More detailed info icons for enemy spawns
parent
5032e61dea
commit
fd5eb86e68
|
@ -282,7 +282,7 @@ public func Definition(def)
|
|||
Rider = nil,
|
||||
FlySpeed = def.FlySpeed
|
||||
};
|
||||
EnemySpawn->AddEnemyDef("BoomAttack", { SpawnType=DefenseBoomAttack, SpawnFunction=def.SpawnBoomAttack, OffsetAttackPathByPos=true }, spawn_default_values, spawn_editor_props);
|
||||
EnemySpawn->AddEnemyDef("BoomAttack", { SpawnType=DefenseBoomAttack, SpawnFunction=def.SpawnBoomAttack, OffsetAttackPathByPos=true, GetInfoString=def.GetSpawnInfoString }, spawn_default_values, spawn_editor_props);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,6 +311,18 @@ private func SpawnBoomAttack(array pos, proplist enemy_data, proplist enemy_def,
|
|||
return boom;
|
||||
}
|
||||
|
||||
private func GetSpawnInfoString(proplist enemy_data)
|
||||
{
|
||||
if (enemy_data.Rider && enemy_data.Rider.Type == "Clonk")
|
||||
{
|
||||
return Format("{{DefenseBoomAttack}}%s", EnemySpawn->GetAIClonkInfoString(enemy_data.Rider.Properties));
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{{DefenseBoomAttack}}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-- Properties --*/
|
||||
|
||||
|
|
|
@ -84,6 +84,12 @@ local SingleWeaponAttackMode = {
|
|||
return Format("$AttackWithAmmo$", this.Weapon->GetName(), this.Ammo->GetName());
|
||||
else
|
||||
return Format("$AttackWith$", this.Weapon->GetName());
|
||||
},
|
||||
GetInfoString = func(proplist ai_def)
|
||||
{
|
||||
// Info icon for given attack mode
|
||||
if (!this.Weapon) return "";
|
||||
if (this.Ammo) return Format("{{%i}}{{%i}}", this.Weapon, this.Ammo); else return Format("{{%i}}", this.Weapon);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -463,6 +463,11 @@ private func UpdateEnemyDisplay()
|
|||
if (msg) Message("@%s", msg); else Message("");
|
||||
}
|
||||
|
||||
public func EditorPropertyChanged()
|
||||
{
|
||||
return UpdateEnemyDisplay();
|
||||
}
|
||||
|
||||
|
||||
/* Editor props and actions */
|
||||
|
||||
|
@ -508,7 +513,7 @@ public func Definition(def)
|
|||
{ Name="$Unlimited$", Value=SPAWNCOUNT_INFINITE },
|
||||
{ Name="$FixedNumber$", Value=1, Type=C4V_Int, Delegate={ Type="int", Min=1, Set="SetMaxConcurrentEnemies", SetRoot=true } }
|
||||
] };
|
||||
AddEnemyDef("Clonk", { SpawnType=Clonk, SpawnFunction=def.SpawnClonk }, def->GetAIClonkDefaultPropValues(), def->GetAIClonkEditorProps());
|
||||
AddEnemyDef("Clonk", { SpawnType=Clonk, SpawnFunction=def.SpawnClonk, GetInfoString=GetAIClonkInfoString }, def->GetAIClonkDefaultPropValues(), def->GetAIClonkEditorProps());
|
||||
}
|
||||
|
||||
public func GetAIClonkEditorProps()
|
||||
|
@ -549,6 +554,15 @@ public func GetAIClonkDefaultPropValues()
|
|||
};
|
||||
}
|
||||
|
||||
public func GetAIClonkInfoString(proplist enemy_props)
|
||||
{
|
||||
var msg = "{{Clonk}}";
|
||||
var attack_mode = AI.AttackModes[enemy_props.AttackMode.Identifier];
|
||||
var str = attack_mode->~GetInfoString(enemy_props.AttackMode);
|
||||
if (str) msg = Format("%s%s", msg, str);
|
||||
return msg;
|
||||
}
|
||||
|
||||
private func SetAIClonkAttackMode(proplist attack_mode)
|
||||
{
|
||||
this.AttackMode.Identifier = attack_mode.Identifier;
|
||||
|
|
|
@ -54,7 +54,13 @@ public func IsInventorProduct() { return true; }
|
|||
|
||||
public func Definition(def)
|
||||
{
|
||||
EnemySpawn->AddEnemyDef("Balloon", { SpawnType=Balloon, SpawnFunction=def.SpawnBalloon, OffsetAttackPathByPos=true }, EnemySpawn->GetAIClonkDefaultPropValues(), EnemySpawn->GetAIClonkEditorProps());
|
||||
EnemySpawn->AddEnemyDef("Balloon",
|
||||
{ SpawnType=Balloon,
|
||||
SpawnFunction=def.SpawnBalloon,
|
||||
OffsetAttackPathByPos=true,
|
||||
GetInfoString=def.GetSpawnInfoString },
|
||||
EnemySpawn->GetAIClonkDefaultPropValues(),
|
||||
EnemySpawn->GetAIClonkEditorProps());
|
||||
}
|
||||
|
||||
private func SpawnBalloon(array pos, proplist clonk_data, proplist enemy_def, array clonk_attack_path, object spawner)
|
||||
|
@ -74,6 +80,12 @@ private func SpawnBalloon(array pos, proplist clonk_data, proplist enemy_def, ar
|
|||
return clonk;
|
||||
}
|
||||
|
||||
private func GetSpawnInfoString(proplist enemy_data)
|
||||
{
|
||||
// Prepend balloon to clonk info string
|
||||
return Format("{{Balloon}}%s", EnemySpawn->GetAIClonkInfoString(enemy_data));
|
||||
}
|
||||
|
||||
|
||||
/*-- Properties --*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue