forked from Mirrors/openclonk
fix removal of ownership on flag movement
parent
cdd490b53c
commit
a5b6066f25
|
@ -15,7 +15,13 @@ protected func Initialize()
|
|||
}
|
||||
|
||||
// This object is affected by ownership radiuses.
|
||||
public func CanBeOwned() { return true; }
|
||||
public func CanBeOwned()
|
||||
{
|
||||
// Flagpoles should not affect the ownership of other flagpoles, so
|
||||
// return false for objects which include both the flag and ownable
|
||||
// library. Return true otherwise.
|
||||
return !this->~IsFlagpole();
|
||||
}
|
||||
|
||||
// Callback from the engine:
|
||||
public func OnOwnerChanged(int new_owner, int old_owner)
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
Flag Library
|
||||
The flagpoles mark the area a player owns. It also serves as an energy transmitter.
|
||||
|
||||
|
||||
Important notes when including this library:
|
||||
* The object including this library should return _inherited(...) in the
|
||||
Construction, Initialize and Destruction callback if overloaded.
|
||||
|
||||
@author Zapper, Maikel
|
||||
*/
|
||||
|
||||
|
@ -354,6 +359,8 @@ private func ClearFlagMarkers()
|
|||
// Engine callback: owner of the flag has changed.
|
||||
protected func OnOwnerChanged(int new_owner, int old_owner)
|
||||
{
|
||||
// Debugging logs.
|
||||
//Log("FLAG - OnOwnerChanged(): flag = %v, new_owner = %d, old_owner = %d", this, new_owner, old_owner);
|
||||
// Reassign owner of flag markers for correct color.
|
||||
for (var marker in lib_flag.range_markers)
|
||||
{
|
||||
|
@ -371,7 +378,7 @@ protected func OnOwnerChanged(int new_owner, int old_owner)
|
|||
protected func OnHostilityChange(int player1, int player2, bool hostile, bool old_hostility)
|
||||
{
|
||||
// Debugging logs.
|
||||
//Log("FLAG - OnHostilityChange(): player1 = %d, player2 = %d, hostile = %v, old_hostility = %v", player1, player2, hostile, old_hostility);
|
||||
//Log("FLAG - OnHostilityChange(): flag = %v, player1 = %d, player2 = %d, hostile = %v, old_hostility = %v", this, player1, player2, hostile, old_hostility);
|
||||
// Redraw radiuses of all flags.
|
||||
RedrawFlagRadius();
|
||||
// Refresh the ownership of the flag's surroundings.
|
||||
|
@ -385,7 +392,7 @@ protected func OnHostilityChange(int player1, int player2, bool hostile, bool ol
|
|||
protected func OnTeamSwitch(int player, int new_team, int old_team)
|
||||
{
|
||||
// Debugging logs.
|
||||
//Log("FLAG - OnTeamSwitch(): player = %d, new_team = %d, old_team = %d", player, new_team, old_team);
|
||||
//Log("FLAG - OnTeamSwitch(): flag = %v, player = %d, new_team = %d, old_team = %d", this, player, new_team, old_team);
|
||||
// Redraw radiuses of all flags.
|
||||
RedrawFlagRadius();
|
||||
// Refresh the ownership of the flag's surroundings.
|
||||
|
|
|
@ -27,11 +27,12 @@
|
|||
according to {obj, cons_amount, priority}.
|
||||
|
||||
OPEN TODOS:
|
||||
* Remove all the if (!link) checks, they are not needed in principle but
|
||||
errors arise when they are removed.
|
||||
* Remove all the if (!link) checks, they are not needed in principle but errors arise when they are removed.
|
||||
* Fix overproduction if a request is not met, e.g. compensator trying to supply a workshop alone.
|
||||
* Implement network separation on hostility changes.
|
||||
* Fix a bug which sometimes appears on deletion of a complicated network. (First reproduce reliably).
|
||||
* Flag library documentation.
|
||||
* Flag markers sometimes not updated (e.g. Gem Grabbers).
|
||||
* Move network merging from flag to power library.
|
||||
* Power visuals of elevator show need while power is available.
|
||||
|
||||
@author Zapper, Maikel
|
||||
*/
|
||||
|
|
|
@ -22,11 +22,13 @@ public func NoConstructionFlip() { return true; }
|
|||
/*-- Interaction --*/
|
||||
|
||||
public func IsInteractable(object clonk)
|
||||
{
|
||||
if (!ObjectCount(Find_ID(Rule_BuyAtFlagpole))) return false;
|
||||
if (GetCon() < 100) return false;
|
||||
return !Hostile(GetOwner(), clonk->GetOwner());
|
||||
}
|
||||
{
|
||||
if (!ObjectCount(Find_ID(Rule_BuyAtFlagpole)))
|
||||
return false;
|
||||
if (GetCon() < 100)
|
||||
return false;
|
||||
return !Hostile(GetOwner(), clonk->GetOwner());
|
||||
}
|
||||
|
||||
public func GetInteractionMetaInfo(object clonk)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue