Skip to content

Commit 82028ac

Browse files
author
Motive
committed
+ Added command 'replaceeffect' to replace a game's knowledge of an effect with an entirely new one. Ex: 'replaceeffect StimPack DropTrainReaper' makes Stimpack call down a Reaper instead.
+ Added command 'replaceunit' to replace a game's knowledge of a unit with an entirely new one. Ex: 'replaceunit Marine Ghost' would make all new references to marines turn into ghosts. - Fixed the alignment of the output of 'colors' command. - Fixed a cosmetic error in 'upgrade'. - Fixed Left/Right attachment points not working properly. - Made smarthostile mostly free of mining dependency by giving it a massive influx of resources. - Removed initializers from CortexHelper trigger library. These are now handled by the Cortex Engine. - Fixed a bug in troll detection that was causing wild trigger errors to crop up now and then. - Added UI override file GameUIOverride.SC2Layout which will be automatically referenced by the Cortex Mod.
1 parent 4d691eb commit 82028ac

10 files changed

+160
-225
lines changed

Commands/Commands.galaxy

+8-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ void libcrtx_commands_init()
2424

2525
// link the commands to their functions.
2626
libcrtx_command_create("info", "libcrtx_command_info");
27-
libcrtx_command_create("minerals", "libcrtx_command_minerals");
28-
libcrtx_command_create("gas", "libcrtx_command_gas");
27+
libcrtx_command_create("minerals", "libcrtx_command_minerals");
28+
libcrtx_command_create("gas", "libcrtx_command_gas");
2929
libcrtx_command_create("alias", "libcrtx_command_alias");
3030
libcrtx_command_create("commands", "libcrtx_command_commands");
3131
libcrtx_command_create("colors", "libcrtx_command_colors");
@@ -41,6 +41,8 @@ void libcrtx_commands_init()
4141
libcrtx_command_create("unally", "libcrtx_command_unally");
4242
libcrtx_command_create("control", "libcrtx_command_control");
4343
libcrtx_command_create("uncontrol", "libcrtx_command_uncontrol");
44+
libcrtx_command_create("replaceeffect", "libcrtx_command_replaceeffect");
45+
libcrtx_command_create("replaceunit", "libcrtx_command_replaceunit");
4446

4547
// unit commands
4648
libcrtx_command_create("@context", "libcrtx_command_context");
@@ -71,11 +73,11 @@ void libcrtx_commands_init()
7173
libcrtx_command_create("@maxshields", "libcrtx_command_maxshields");
7274
libcrtx_command_create("@speed", "libcrtx_command_speed");
7375
libcrtx_command_create("@kills", "libcrtx_command_kills");
74-
libcrtx_command_create("@level", "libcrtx_command_level");
75-
libcrtx_command_create("@adddamage", "libcrtx_command_adddamage");
76+
libcrtx_command_create("@level", "libcrtx_command_level");
77+
libcrtx_command_create("@adddamage", "libcrtx_command_adddamage");
7678
libcrtx_command_create("@removedamage", "libcrtx_command_removedamage");
77-
libcrtx_command_create("@attach", "libcrtx_command_attach");
78-
libcrtx_command_create("@removearea", "libcrtx_command_removearea");
79+
libcrtx_command_create("@attach", "libcrtx_command_attach");
80+
libcrtx_command_create("@removearea", "libcrtx_command_removearea");
7981
libcrtx_command_create("@removebehavior", "libcrtx_command_removebehavior");
8082
libcrtx_command_create("@addbehavior", "libcrtx_command_addbehavior");
8183
libcrtx_command_create("@firstperson", "libcrtx_command_firstperson");

Commands/MainCommands.galaxy

+58-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bool libcrtx_command_colors(bool testConds, bool runActions) {
6464
if( PlayerStatus(i) != c_playerStatusUnused ) {
6565
t = t + libcrtx_colored_player_name(i);
6666
t = t + StringToText(" (" + libcrtx_color_from_player(i) + ")");
67-
t = t + StringToText("<n/> ");
67+
t = t + StringToText("<n/>");
6868
}
6969
i = i + 1;
7070
}
@@ -453,7 +453,7 @@ bool libcrtx_command_upgrade(bool testConds, bool runActions)
453453
else if(nextParam != "0" && newLevel == 0)
454454
{
455455
libcrtx_write(PlayerGroupSingle(EventPlayer()),
456-
"Usage: @upgrade upgradename [on/off/query/number]");
456+
"Usage: upgrade upgradename [on/off/query/number]");
457457
return true;
458458
}
459459
}
@@ -712,4 +712,60 @@ bool libcrtx_command_uncontrol(bool testConds, bool runActions)
712712
return true;
713713
}
714714

715+
bool libcrtx_command_replaceunit(bool testConds, bool runActions)
716+
{
717+
string source = StringWord(libcrtx_chat_get_parse_line(EventPlayer()), 2);
718+
string replace = StringWord(libcrtx_chat_get_parse_line(EventPlayer()), 3);
719+
unitgroup g = libcrtx_chat_get_context(EventPlayer());
720+
721+
source = libcrtx_param_catalog(c_gameCatalogUnit, source);
722+
replace = libcrtx_param_catalog(c_gameCatalogUnit, replace);
723+
724+
if( source == "" || replace == "" || libcrtx_toolkit_isrestrictedunit(source) || libcrtx_toolkit_isrestrictedunit(replace) ) {
725+
return true;
726+
}
727+
728+
// So that this command works on hostile/other players, if we are selecting other player's units, run this command on them.
729+
if( UnitGroupCount(g, c_unitCountAlive) > 0 )
730+
{
731+
UnitGroupLoopBegin(g);
732+
while(!UnitGroupLoopDone())
733+
{
734+
CatalogLinkReplace(UnitGetOwner(UnitGroupLoopCurrent()), c_gameCatalogUnit, source, replace);
735+
UnitGroupLoopStep();
736+
}
737+
UnitGroupLoopEnd();
738+
} else {
739+
CatalogLinkReplace(EventPlayer(), c_gameCatalogUnit, source, replace);
740+
}
741+
return true;
742+
}
715743

744+
bool libcrtx_command_replaceeffect(bool testConds, bool runActions)
745+
{
746+
string source = StringWord(libcrtx_chat_get_parse_line(EventPlayer()), 2);
747+
string replace = StringWord(libcrtx_chat_get_parse_line(EventPlayer()), 3);
748+
unitgroup g = libcrtx_chat_get_context(EventPlayer());
749+
750+
source = libcrtx_param_catalog(c_gameCatalogEffect, source);
751+
replace = libcrtx_param_catalog(c_gameCatalogEffect, replace);
752+
753+
if( source == "" || replace == "" || libcrtx_toolkit_isrestrictedeffect(source) || libcrtx_toolkit_isrestrictedeffect(replace) ) {
754+
return true;
755+
}
756+
757+
// So that this command works on hostile/other players, if we are selecting other player's units, run this command on them.
758+
if( UnitGroupCount(g, c_unitCountAlive) > 0 )
759+
{
760+
UnitGroupLoopBegin(g);
761+
while(!UnitGroupLoopDone())
762+
{
763+
CatalogLinkReplace(UnitGetOwner(UnitGroupLoopCurrent()), c_gameCatalogEffect, source, replace);
764+
UnitGroupLoopStep();
765+
}
766+
UnitGroupLoopEnd();
767+
} else {
768+
CatalogLinkReplace(EventPlayer(), c_gameCatalogEffect, source, replace);
769+
}
770+
return true;
771+
}

Commands/UnitCommands.galaxy

+11-41
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,8 @@ bool libcrtx_command_removedamage(bool testConds, bool runActions) {
840840
}
841841

842842
bool libcrtx_command_attach(bool testConds, bool runActions) {
843+
actor sactor;
844+
string aliasName;
843845
string actr;
844846
string apoint;
845847
string scope;
@@ -850,8 +852,9 @@ bool libcrtx_command_attach(bool testConds, bool runActions) {
850852
unitgroup g = libcrtx_chat_get_context(EventPlayer());
851853
actr = StringWord( libcrtx_chat_get_parse_line(EventPlayer()), 2 );
852854
apoint = StringWord( libcrtx_chat_get_parse_line(EventPlayer()), 3 );
853-
attachPoints = "Origin Center Damage Damage01 Damage02 Engine Hardpoint Hardpoint01 Hardpoint02 Hardpoint03 Hardpoint04 HardpointLeft HardpointRight Head Hit Hit01 Hit02 Hit03 Hit04 Hit05 Hit06 Hit07 Hit08 Hit09 Overhead RallyPoint StatusBar Left Right";
854-
attachPoints += "Target Target01 Target02 Target03 TargetHeavy TargetLight TargetMedium TargetShield Turret TurretY TurretZ Upgrade UpgradeArmor UpgradeEngine UpgradeEngineBottom UpgradeEngineLeft UpgradeEngineRight UpgradeWeapon UpgradeWeaponBottom UpgradeWeaponleft UpgradeWeaponRight Weapon Weapon01 Weapon02 Weapon03 Weapon04 WeaponBottom WeaponLeft WeaponRight";
855+
aliasName = StringWord( libcrtx_chat_get_parse_line(EventPlayer()), 4);
856+
attachPoints = "Origin Center Damage Damage01 Damage02 Engine Hardpoint Hardpoint01 Hardpoint02 Hardpoint03 Hardpoint04 HardpointLeft HardpointRight Head Hit Hit01 Hit02 Hit03 Hit04 Hit05 Hit06 Hit07 Hit08 Hit09 Overhead RallyPoint StatusBar Left Right ";
857+
attachPoints += "Target Target01 Target02 Target03 TargetHeavy TargetLight TargetMedium TargetShield Turret TurretY TurretZ Upgrade UpgradeArmor UpgradeEngine UpgradeEngineBottom UpgradeEngineLeft UpgradeEngineRight UpgradeWeapon UpgradeWeaponBottom UpgradeWeaponleft UpgradeWeaponRight Weapon Weapon01 Weapon02 Weapon03 Weapon04 WeaponBottom WeaponLeft WeaponRight ";
855858

856859
if( apoint == "" ) {
857860
apoint = "Origin";
@@ -878,30 +881,7 @@ bool libcrtx_command_attach(bool testConds, bool runActions) {
878881
libcrtx_write(PlayerGroupSingle(EventPlayer()), "<c val=\"ff0000\">Warning</c>: Invalid attachment point, defaulting to Origin.<n/>You can obtain a list of attachment points by typing <c val=\"00ff00\">@attach listpoints</c>.");
879882
}
880883

881-
// Look up this Actor and verify it is not CActorEventMacro
882-
if( !CatalogEntryIsValid(c_gameCatalogActor, actr) ) {
883-
// Let's try to rectify this for the user. Maybe they're stupid and can't use capital letters. :P
884-
// This section will transfer "marine" to "Marine" if they get the name of the actor right but not the case.
885-
x = CatalogEntryCount(c_gameCatalogActor);
886-
i = 1;
887-
s = "";
888-
while( i != x ) {
889-
s = CatalogEntryGet(c_gameCatalogActor, i);
890-
if( StringEqual(s, actr, false) ) {
891-
break;
892-
}
893-
i = i + 1;
894-
}
895-
896-
// Did we find a match? if not, quit.
897-
if( i == x ) {
898-
return true;
899-
}
900-
901-
// Use the correctly referenced actor.
902-
actr = s;
903-
}
904-
884+
actr = libcrtx_param_catalog(c_gameCatalogActor, actr);
905885
scope = CatalogEntryScope( c_gameCatalogActor, actr );
906886
if( scope == "CActorEventMacro" || scope == "CActorSound" ) {
907887
return true;
@@ -910,7 +890,8 @@ bool libcrtx_command_attach(bool testConds, bool runActions) {
910890
UnitGroupLoopBegin(g);
911891
while(!UnitGroupLoopDone())
912892
{
913-
libNtve_gf_AttachActorToUnit( UnitGroupLoopCurrent(), actr, apoint);
893+
// Attach the actor to the unit
894+
libNtve_gf_AttachActorToUnit(UnitGroupLoopCurrent(), actr, apoint);
914895
UnitGroupLoopStep();
915896
}
916897
UnitGroupLoopEnd();
@@ -963,19 +944,7 @@ bool libcrtx_command_addbehavior(bool testConds, bool runActions) {
963944
val = StringWord( libcrtx_chat_get_parse_line(EventPlayer()), 2 );
964945

965946
// Check for an invalid behavior name, and attempt to compensate.
966-
if( !CatalogEntryIsValid(c_gameCatalogBehavior, val) ) {
967-
x = CatalogEntryCount(c_gameCatalogBehavior);
968-
i = 1;
969-
while( i != x ) {
970-
s = CatalogEntryGet(c_gameCatalogBehavior, i);
971-
if( StringEqual(s, val, false) ) {
972-
val = s;
973-
break;
974-
}
975-
i = i + 1;
976-
}
977-
978-
}
947+
val = libcrtx_param_catalog(c_gameCatalogBehavior, val);
979948

980949
if( libcrtx_toolkit_isrestrictedbehavior(val) ) {
981950
return true;
@@ -2188,4 +2157,5 @@ bool libcrtx_command_rotate(bool testConds, bool runActions)
21882157
}
21892158
UnitGroupLoopEnd();
21902159
return true;
2191-
}
2160+
}
2161+

Common/ComputerAI.galaxy

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ void libcrtx_ai_start()
5252
libcrtx_ai_setup = true;
5353

5454
// Get 'em started on minerals.
55-
PlayerModifyPropertyInt( player, c_playerPropMinerals, c_playerPropOperAdd, 1000 );
56-
PlayerModifyPropertyInt( player, c_playerPropVespene, c_playerPropOperAdd, 1000 );
55+
PlayerModifyPropertyInt( player, c_playerPropMinerals, c_playerPropOperAdd, 500000 );
56+
PlayerModifyPropertyInt( player, c_playerPropVespene, c_playerPropOperAdd, 500000 );
5757

5858
AIStart(player, false, 400);
5959

Common/Global.galaxy

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const string libcrtx_version_commit = "61685e0d9632e08881b22dbfaf56985777dc01bc"
2121
// Version in form major.minor.bugfix.hotfix
2222
// ex: "0.10.1a" when concatenated
2323
const int libcrtx_version_major = 2;
24-
const int libcrtx_version_minor = 0;
24+
const int libcrtx_version_minor = 1;
2525
const int libcrtx_version_bugfix = 0;
2626
const string libcrtx_version_hotfix = "";
2727

0 commit comments

Comments
 (0)