2025-07-18 20:30 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000575Spring engineGeneralpublic2007-08-31 09:17
Reporteryuritch 
Assigned Toimbaczek 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000575: [patch] Allow some control over fire at crashing planes
DescriptionThis allows for the modder to define whether the crashing planes (and/or units running long Killed() scripts) can be fired on via modrules.tdf new section:
[FIREATDEAD]
{
  fireAtKilled=0;
  fireAtCrashing=0;
}
The defaults are to disallow both (Spring 0.75 behaviour, both variables set to 0). Spring 0.74 behaviour (allow both) can be emulated by setting both variables to 1.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon fireAtDead.patch (3,135 bytes) 2007-08-02 08:25 -
    Index: rts/Lua/LuaConstGame.cpp
    ===================================================================
    --- rts/Lua/LuaConstGame.cpp	(revision 4121)
    +++ rts/Lua/LuaConstGame.cpp	(working copy)
    @@ -68,6 +68,8 @@
     	LuaPushNamedNumber(L, "transportShip",   modInfo->transportShip);
     	LuaPushNamedNumber(L, "transportHover",  modInfo->transportHover);
     	LuaPushNamedNumber(L, "transportGround", modInfo->transportGround);
    +	LuaPushNamedNumber(L, "fireAtKilled", modInfo->fireAtKilled);
    +	LuaPushNamedNumber(L, "fireAtCrashing", modInfo->fireAtCrashing);
     
     	char buf[64];
     	SNPRINTF(buf, sizeof(buf), "0x%08X",
    Index: rts/Sim/ModInfo.cpp
    ===================================================================
    --- rts/Sim/ModInfo.cpp	(revision 4121)
    +++ rts/Sim/ModInfo.cpp	(working copy)
    @@ -43,6 +43,21 @@
     		// We already set the defaults so we should be able to ignore this
     		// Other optional mod rules MUST set their defaults...
     	}
    +	//Get the fire-at-dead-units options
    +	fireAtKilled = 0;
    +	fireAtCrashing = 0;
    +	//See if the mod overrides them
    +	try
    +	{
    +		TdfParser fireAtDeadOptions("gamedata/modrules.tdf");
    +		fireAtKilled = atoi(fireAtDeadOptions.SGetValueDef("0", "FIREATDEAD\\FireAtKilled").c_str());
    +		fireAtCrashing = atoi(fireAtDeadOptions.SGetValueDef("0", "FIREATDEAD\\FireAtCrashing").c_str());
    +	}
    +	catch(content_error) // If the modrules.tdf isnt found
    +	{
    +		// We already set the defaults so we should be able to ignore this
    +		// Other optional mod rules MUST set their defaults...
    +	}
     	//Get the transportability options for the mod
     	transportGround = 1;
     	transportHover = 0;
    Index: rts/Sim/ModInfo.h
    ===================================================================
    --- rts/Sim/ModInfo.h	(revision 4121)
    +++ rts/Sim/ModInfo.h	(working copy)
    @@ -22,6 +22,10 @@
     	int transportShip;	//0 = all naval units cannot be transported, 1 = all naval units can be transported (mass and size restrictions still apply). Defaults to 0.
     	int transportAir;	//0 = all air units cannot be transported, 1 = all air units can be transported (mass and size restrictions still apply). Defaults to 0.
     
    +	//Fire on dying units behaviour
    +	int fireAtKilled;	//1 = units fire at enemies running Killed() script, 0 = units ignore such enemies
    +	int fireAtCrashing;	//1 = units fire at crashing aircrafts, 0 = units ignore crashing aircrafts
    +
     };
     
     extern CModInfo *modInfo;
    Index: rts/Sim/Weapons/Weapon.cpp
    ===================================================================
    --- rts/Sim/Weapons/Weapon.cpp	(revision 4121)
    +++ rts/Sim/Weapons/Weapon.cpp	(working copy)
    @@ -23,6 +23,7 @@
     #include "Sim/Misc/LosHandler.h"
     #include "Sim/Misc/GeometricObjects.h"
     #include "Sim/MoveTypes/TAAirMoveType.h"
    +#include "Sim/ModInfo.h"
     #include "creg/STL_List.h"
     #include "mmgr.h"
     #include "float3.h"
    @@ -544,7 +545,7 @@
     	if(unit && !(onlyTargetCategory&unit->category))
     		return false;
     
    -	if(unit && (unit->isDead || unit->crashing))
    +	if(unit && ((unit->isDead && (modInfo->fireAtKilled==0)) || (unit->crashing && (modInfo->fireAtCrashing==0))))
     		return false;
     
     	if(weaponDef->stockpile && !numStockpiled)
    
    patch file icon fireAtDead.patch (3,135 bytes) 2007-08-02 08:25 +

-Relationships
+Relationships

-Notes

~0001195

imbaczek (reporter)

committed in r4268, thanks.
+Notes

-Issue History
Date Modified Username Field Change
2007-08-02 08:25 yuritch New Issue
2007-08-02 08:25 yuritch File Added: fireAtDead.patch
2007-08-31 09:17 imbaczek Status new => resolved
2007-08-31 09:17 imbaczek Resolution open => fixed
2007-08-31 09:17 imbaczek Assigned To => imbaczek
2007-08-31 09:17 imbaczek Note Added: 0001195
+Issue History