Skip to content

Commit

Permalink
nlc
Browse files Browse the repository at this point in the history
  • Loading branch information
rtri committed Nov 14, 2019
1 parent 8e4be27 commit 4b8602b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rts/Lua/LuaSyncedCtrl.cpp
Expand Up @@ -1701,7 +1701,7 @@ int LuaSyncedCtrl::SetUnitUseWeapons(lua_State* L)
return 0;

unit->forceUseWeapons = luaL_optboolean(L, 2, unit->forceUseWeapons);
unit->blockUseWeapons = luaL_optboolean(L, 3, unit->blockUseWeapons);
unit->allowUseWeapons = luaL_optboolean(L, 3, unit->allowUseWeapons);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/Units/Unit.cpp
Expand Up @@ -2817,7 +2817,7 @@ CR_REG_METADATA(CUnit, (
CR_MEMBER(onTempHoldFire),

CR_MEMBER(forceUseWeapons),
CR_MEMBER(blockUseWeapons),
CR_MEMBER(allowUseWeapons),

CR_MEMBER(deathScriptFinished),
CR_MEMBER(delayedWreckLevel),
Expand Down
4 changes: 2 additions & 2 deletions rts/Sim/Units/Unit.h
Expand Up @@ -159,7 +159,7 @@ class CUnit : public CSolidObject

bool HaveTarget() const { return (curTarget.type != Target_None); }
bool CanUpdateWeapons() const {
return (forceUseWeapons || (!blockUseWeapons && !onTempHoldFire !isDead && !beingBuilt && !IsStunned()));
return (forceUseWeapons || (allowUseWeapons && !onTempHoldFire !isDead && !beingBuilt && !IsStunned()));
}

void SetNeutral(bool b);
Expand Down Expand Up @@ -502,7 +502,7 @@ class CUnit : public CSolidObject

// Lua overrides for CanUpdateWeapons
bool forceUseWeapons = false;
bool blockUseWeapons = false;
bool allowUseWeapons = true;

// signals if script has finished executing Killed and the unit can be deleted
bool deathScriptFinished = false;
Expand Down

0 comments on commit 4b8602b

Please sign in to comment.