From 4243c136586a4c38755e4b1baaa3937720c92ba7 Mon Sep 17 00:00:00 2001 From: Daid Date: Fri, 13 Sep 2024 15:42:47 +0200 Subject: [PATCH] Two more TODOs gone --- scripts/api/entity/shiptemplatebasedobject.lua | 3 +++ src/script/enum.h | 6 +++--- src/spaceObjects/spaceObject.cpp | 17 ----------------- src/spaceObjects/spaceship.cpp | 10 ---------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/scripts/api/entity/shiptemplatebasedobject.lua b/scripts/api/entity/shiptemplatebasedobject.lua index 429efaea45..c1478e7605 100644 --- a/scripts/api/entity/shiptemplatebasedobject.lua +++ b/scripts/api/entity/shiptemplatebasedobject.lua @@ -53,6 +53,9 @@ function Entity:setTemplate(template_name) crew.components.internal_repair_crew = {} end end + if comp.shields and template.__type ~= "station" then + comp.shields.frequency = irandom(0, 20) + end return self end --- [DEPRECATED] diff --git a/src/script/enum.h b/src/script/enum.h index b020d6dfb6..5c7da3edfe 100644 --- a/src/script/enum.h +++ b/src/script/enum.h @@ -90,11 +90,11 @@ template<> struct Convert { } static ScanState::State fromLua(lua_State* L, int idx) { string str = string(luaL_checkstring(L, idx)).lower(); - if (str == "none") + if (str == "none" || str == "notscanned" || str == "not") return ScanState::State::NotScanned; - else if (str == "fof") + else if (str == "fof" || str == "friendorfoeidentified") return ScanState::State::FriendOrFoeIdentified; - else if (str == "simple") + else if (str == "simple" || str == "simplescan") return ScanState::State::SimpleScan; else if (str == "full" || str == "fullscan") return ScanState::State::FullScan; diff --git a/src/spaceObjects/spaceObject.cpp b/src/spaceObjects/spaceObject.cpp index a396d16aa0..e69de29bb2 100644 --- a/src/spaceObjects/spaceObject.cpp +++ b/src/spaceObjects/spaceObject.cpp @@ -1,17 +0,0 @@ -/*TODO -template<> void convert::param(lua_State* L, int& idx, ScanState::State& ss) -{ - ss = ScanState::State::NotScanned; - if (!lua_isstring(L, idx)) - return; - string str = string(luaL_checkstring(L, idx++)).lower(); - if (str == "notscanned" || str == "not") - ss = ScanState::State::NotScanned; - else if (str == "friendorfoeidentified") - ss = ScanState::State::FriendOrFoeIdentified; - else if (str == "simple" || str == "simplescan") - ss = ScanState::State::SimpleScan; - else if (str == "full" || str == "fullscan") - ss = ScanState::State::FullScan; -} -*/ \ No newline at end of file diff --git a/src/spaceObjects/spaceship.cpp b/src/spaceObjects/spaceship.cpp index 10747dd78f..b3c76519ce 100644 --- a/src/spaceObjects/spaceship.cpp +++ b/src/spaceObjects/spaceship.cpp @@ -29,16 +29,6 @@ #include -/*TODO -SpaceShip::SpaceShip(string multiplayerClassName, float multiplayer_significant_range) -: ShipTemplateBasedObject(50, multiplayerClassName, multiplayer_significant_range) -{ - auto shields = entity.getComponent(); - if (shields) - shields->frequency = irandom(0, BeamWeaponSys::max_frequency); -} -*/ - /*TODO void SpaceShip::draw3DTransparent() {