Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
seedship committed Feb 23, 2025
1 parent 2f6cbc7 commit ee91f41
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rts/Lua/LuaSyncedCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,7 @@ static bool SetSingleUnitWeaponState(lua_State* L, CWeapon* weapon, int index)
} break;

case hashString("ttl"): {
weapon->ttl = lua_toint(L, index + 1);
weapon->ttl = (int) (lua_toint(L, index + 1) * GAME_SPEED);
} break;

default: {
Expand Down
6 changes: 3 additions & 3 deletions rts/Sim/Projectiles/WeaponProjectiles/StarburstProjectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ CStarburstProjectile::CStarburstProjectile(const ProjectileParams& params): CWea

if (weaponDef != nullptr) {
maxSpeed = weaponDef->projectilespeed;
ttl = weaponDef->flighttime;
ttl = params.ttl;

// Default uptime is -1. Positive values override the weapondef.
// Default uptime is -1. Positive values override the projectile params.
if (uptime < 0)
uptime = weaponDef->uptime * GAME_SPEED;

if (weaponDef->flighttime == 0)
if (ttl == 0)
ttl = std::min(3000.0f, uptime + myrange / maxSpeed + 100);
}

Expand Down
1 change: 1 addition & 0 deletions rts/Sim/Weapons/StarburstLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ void CStarburstLauncher::FireImpl(const bool scriptCall)
params.error = aimError;
// Projectile TTL (params.ttl) is ignored by the Starburst Projectile and it only uses the weapondef.
// I tried overriding the projectile TTL to 1 and it caused the starburst rocket to fly off into space
params.ttl = (ttl > 0) ? ttl: weaponDef->flighttime;
params.tracking = tracking;
params.maxRange = (ttl > 0 || weaponDef->fixedLauncher)? MAX_PROJECTILE_RANGE: range;

Expand Down

0 comments on commit ee91f41

Please sign in to comment.