forked from beyond-all-reason/Beyond-All-Reason
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
567 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ local armorDefs = { | |
"legstone", | ||
"dice", | ||
"chip", | ||
"legmohoconin", | ||
}, | ||
crawlingbombs = { | ||
"armvader", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
function gadget:GetInfo() | ||
return { | ||
name = 'Legion Con Turret Metal Extractor', | ||
desc = 'Allows the mex to function as a con turret by replacing it with a fake mex with a con turret attached', | ||
author = 'EnderRobo', | ||
version = 'v1', | ||
date = 'September 2024', | ||
license = 'GNU GPL, v2 or later', | ||
layer = 12, | ||
enabled = true | ||
} | ||
end | ||
|
||
if not gadgetHandler:IsSyncedCode() then | ||
return false | ||
end | ||
|
||
local SpGetUnitPosition = Spring.GetUnitPosition | ||
local SpGetUnitDefID = Spring.GetUnitDefID | ||
local SpGetUnitAllyTeam = Spring.GetUnitAllyTeam | ||
local SpGetUnitHealth = Spring.GetUnitHealth | ||
local SpGetUnitBuildFacing = Spring.GetUnitBuildFacing | ||
local SpGetUnitIsDead = Spring.GetUnitIsDead | ||
local SpGetUnitStates = Spring.GetUnitStates | ||
|
||
function gadget:UnitFinished(unitID, unitDefID, unitTeam) | ||
|
||
local unitDef = UnitDefs[unitDefID] | ||
if unitDef.name == "legmohocon" then -- checks for mex | ||
local nano_id | ||
local imex_id | ||
local health | ||
local facing | ||
local xx,yy,zz | ||
xx,yy,zz = SpGetUnitPosition(unitID) | ||
facing = SpGetUnitBuildFacing(unitID) | ||
health = SpGetUnitHealth(unitID) -- saves location, rotation and health of mex | ||
imex_id = Spring.CreateUnit("legmohoconin",xx,yy,zz,facing,Spring.GetUnitTeam(unitID) ) -- creates imex on mex | ||
if not imex_id then | ||
return | ||
end | ||
Spring.SetUnitBlocking(imex_id, true, false, false) -- makes imex non interactive | ||
Spring.SetUnitNoSelect(imex_id,true) | ||
nano_id = Spring.CreateUnit("legmohoconct",xx,yy,zz,facing,Spring.GetUnitTeam(imex_id) ) -- creates con on imex | ||
if not nano_id then | ||
return | ||
end | ||
Spring.UnitAttach(imex_id,nano_id,6) -- attaches con to imex | ||
Spring.SetUnitHealth(nano_id, health) -- sets con health to be the same as mex | ||
Spring.DestroyUnit(unitID, false, true) -- removes mex | ||
end | ||
end | ||
|
||
function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) | ||
|
||
local unitDef = UnitDefs[unitDefID] | ||
if unitDef.name == "legmohoconct" then | ||
local health | ||
local maxHealth | ||
health, maxHealth = SpGetUnitHealth(unitID) | ||
if not (health > 0) then -- when damaged and killed | ||
local xx,yy,zz | ||
local facing | ||
xx,yy,zz = SpGetUnitPosition(unitID) | ||
facing = SpGetUnitBuildFacing(unitID) | ||
if damage < (maxHealth / 3) then -- if damage is <33% of max health spawn wreck | ||
local featureID | ||
featureID = Spring.CreateFeature("legmohocon_dead", xx, yy, zz, facing, unitTeam) | ||
Spring.SetFeatureResurrect(featureID, "legmohocon", facing, 0) | ||
end | ||
if damage > (maxHealth / 3) and damage < ((maxHealth / 3) * 2) then -- if damage is >33% and <66% of max health spawn heap | ||
Spring.CreateFeature("legmohocon_heap", xx, yy, zz, facing, unitTeam) | ||
end | ||
end | ||
end | ||
end | ||
|
||
function gadget:UnitDestroyed(unitID, unitDefID, unitTeam, attackerID, attackerDefID, attackerTeam) -- if con dies remove imex | ||
|
||
local unitDef = UnitDefs[unitDefID] | ||
if unitDef.name == "legmohoconct" then | ||
Spring.DestroyUnit(Spring.GetUnitTransporter(unitID), false, true) | ||
end | ||
end | ||
|
||
|
||
|
||
--[[ | ||
mex built done | ||
place imex on mex done | ||
attach con turret to imex done | ||
copy mex health to con Turret done | ||
remove mex done | ||
on turret death remove imex done | ||
make it spawn wrecks and heaps done | ||
To do: | ||
if damaged during construction cons continue to repair | ||
on off switch for mex via turret | ||
make turret display metal income and energy upkeep of mex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
#include "../recoil_common_includes.h" | ||
|
||
piece base, aim, nano1, nano2, rotor, attach; | ||
|
||
#define BASEPIECE base | ||
#define MAXTILT 0 | ||
#include "../unit_hitbyweaponid_and_smoke.h" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
|
||
#include "sfxtype.h" | ||
#include "exptype.h" | ||
|
||
piece base, aim, nano1, nano2, rotor, attach; | ||
|
||
static-var Stunned, spray, BuildHeading; | ||
|
||
#define BASEPIECE base | ||
#define HITSPEED <55.0> | ||
//how 'heavy' the unit is, on a scale of 1-10 | ||
#define UNITSIZE 2 | ||
#define MAXTILT 100 | ||
|
||
#include "unit_hitbyweaponid_and_smoke.h" | ||
|
||
static-var Stunned; | ||
ExecuteRestoreAfterDelay() | ||
{ | ||
if (Stunned) { | ||
return (1); | ||
} | ||
turn aim to y-axis <0.000000> speed <100.000000>; | ||
} | ||
|
||
RestoreAfterDelay() | ||
{ | ||
sleep 5000; | ||
start-script ExecuteRestoreAfterDelay(); | ||
} | ||
|
||
Create() | ||
{ | ||
hide nano1; | ||
hide nano2; | ||
BuildHeading = 0; | ||
spin rotor around y-axis speed <180> accelerate <0.5>; | ||
return (0); | ||
} | ||
|
||
SetStunned(State) | ||
{ | ||
Stunned = State; | ||
if (!Stunned) { | ||
start-script ExecuteRestoreAfterDelay(); | ||
} | ||
} | ||
|
||
StartBuilding(heading) | ||
{ | ||
signal 1; // stop the restore delay stuff | ||
BuildHeading = heading; | ||
show nano1; | ||
show nano2; | ||
turn aim to y-axis BuildHeading speed <320.000000>; | ||
wait-for-turn aim around y-axis; | ||
set INBUILDSTANCE to 1; | ||
} | ||
|
||
StopBuilding() | ||
{ | ||
hide nano1; | ||
hide nano2; | ||
set INBUILDSTANCE to 0; | ||
signal 1; // we must signal here, instead of in RestoreAfterDelay(), as that only gets called 1 frame later, so startbuilding wont terminate it | ||
set-signal-mask 1; // make child threads inherit signal mask of 1 | ||
start-script RestoreAfterDelay(); | ||
} | ||
|
||
QueryNanoPiece(piecenum) | ||
{ | ||
spray = (spray + 1) % 2; | ||
piecenum = nano1 + spray; | ||
} | ||
|
||
SweetSpot(piecenum) | ||
{ | ||
piecenum = aim; | ||
} | ||
|
||
|
||
Killed(severity, corpsetype) | ||
{ | ||
if( severity <= 25 ) | ||
{ | ||
corpsetype = 1 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type FIRE | SMOKE | FALL | BITMAPONLY | NOHEATCLOUD; | ||
return(corpsetype); | ||
} | ||
if( severity <= 50 ) | ||
{ | ||
corpsetype = 2 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type FIRE | SMOKE | FALL | NOHEATCLOUD; | ||
return(corpsetype); | ||
} | ||
if( severity <= 99 ) | ||
{ | ||
corpsetype = 3 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type FIRE | SMOKE | FALL | NOHEATCLOUD; | ||
return(corpsetype); | ||
} | ||
corpsetype = 3 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; | ||
return corpsetype; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
#include "../recoil_common_includes.h" | ||
|
||
piece base, aim, nano1, nano2, rotor, attach; | ||
|
||
Create() | ||
{ | ||
hide base; | ||
hide aim; | ||
hide nano1; | ||
hide nano2; | ||
hide rotor; | ||
hide attach; | ||
return (0); | ||
} | ||
|
||
|
||
#define BASEPIECE base | ||
#define MAXTILT 0 | ||
#include "../unit_hitbyweaponid_and_smoke.h" | ||
|
||
Activate() | ||
{ | ||
} | ||
|
||
Deactivate() | ||
{ | ||
} | ||
|
||
|
||
Killed(severity, corpsetype) | ||
{ | ||
if( severity <= 25 ) | ||
{ | ||
corpsetype = 1 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type FIRE | SMOKE | FALL | BITMAPONLY | NOHEATCLOUD; | ||
return(corpsetype); | ||
} | ||
if( severity <= 50 ) | ||
{ | ||
corpsetype = 2 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type FIRE | SMOKE | FALL | NOHEATCLOUD; | ||
return(corpsetype); | ||
} | ||
if( severity <= 99 ) | ||
{ | ||
corpsetype = 3 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type FIRE | SMOKE | FALL | NOHEATCLOUD; | ||
return(corpsetype); | ||
} | ||
corpsetype = 3 ; | ||
explode base type BITMAPONLY | NOHEATCLOUD; | ||
explode rotor type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; | ||
return corpsetype; | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.