Skip to content

Commit a7e155d

Browse files
author
Motive
committed
- Fixed a bug where players could spawn multiple spawners.
1 parent af755f9 commit a7e155d

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

Commands/UnitCommands.galaxy

+5
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,11 @@ bool libcrtx_command_effect(bool testConds, bool runActions)
17491749
bool errors = false;
17501750

17511751
effect = libcrtx_param_catalog(c_gameCatalogEffect, effect);
1752+
if( libcrtx_toolkit_isrestrictedeffect(effect) ) {
1753+
libcrtx_write(PlayerGroupSingle(EventPlayer()), "<c val=\"ff0000\">Unable to create effect</c>: That effect is restricted.");
1754+
return true;
1755+
}
1756+
17521757
if(effect == null)
17531758
{
17541759
libcrtx_write(PlayerGroupSingle(EventPlayer()), "<c val=\"ff0000\">Unable to create effect</c>: No such effect exists.");

Toolkit/DefaultToolkit/DefaultToolkit.galaxy

+2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
include "Cortex/Toolkit/DefaultToolkit/WeaponToolkit.galaxy"
1717
include "Cortex/Toolkit/DefaultToolkit/UnitToolkit.galaxy"
1818
include "Cortex/Toolkit/DefaultToolkit/BehaviorToolkit.galaxy"
19+
include "Cortex/Toolkit/DefaultToolkit/EffectToolkit.galaxy"
1920

2021
void libcrtx_toolkit_default_init()
2122
{
2223
libcrtx_toolkit_default_initweapons();
2324
libcrtx_toolkit_default_initunittools();
2425
libcrtx_toolkit_default_initrestrictedunits();
2526
libcrtx_toolkit_default_initbehaviors();
27+
libcrtx_toolkit_default_initeffects();
2628
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Cortex SC2 Roleplaying Engine
2+
// Copyright (C) 2009-2010 <http://www.cortexrp.com/>
3+
//
4+
// This program is free software; you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation; version 2 of the License.
7+
//
8+
// This program is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
// GNU General Public License for more details.
12+
// Toolkit file for weapon names
13+
14+
void libcrtx_toolkit_default_initeffects()
15+
{
16+
// restricted effects
17+
libcrtx_toolkit_addrestrictedeffect("CreateSpawner");
18+
}

Toolkit/ToolkitStorage.galaxy

+13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
const string libcrtx_toolkit_prefix_weapon = "toolkit_weapon_";
1414
const string libcrtx_toolkit_prefix_restrictedunit = "toolkit_restrictedunit_";
1515
const string libcrtx_toolkit_prefix_restrictedbehavior = "toolkit_restrictedbehavior_";
16+
const string libcrtx_toolkit_prefix_restrictedeffect = "toolkit_restrictedeffect_";
1617

1718
static string libcrtx_toolkit_levelbehavior = "";
1819
static string libcrtx_toolkit_experiencegiverbehavior = "";
@@ -34,6 +35,18 @@ bool libcrtx_toolkit_isrestrictedbehavior(string behName)
3435
return DataTableGetBool(true, lookup);
3536
}
3637

38+
void libcrtx_toolkit_addrestrictedeffect(string restrictedEffect)
39+
{
40+
string storeAs = StringCase(libcrtx_toolkit_prefix_restrictedeffect + restrictedEffect, false);
41+
DataTableSetBool(true, storeAs, true );
42+
}
43+
44+
bool libcrtx_toolkit_isrestrictedeffect(string effName)
45+
{
46+
string lookup = StringCase( libcrtx_toolkit_prefix_restrictedeffect + effName, false );
47+
return DataTableGetBool(true, lookup);
48+
}
49+
3750
void libcrtx_toolkit_addrestrictedunit(string restrictedUnit)
3851
{
3952
string storeAs = StringCase(libcrtx_toolkit_prefix_restrictedunit + UnitTypeFromString(restrictedUnit), false);

0 commit comments

Comments
 (0)