Fix vehicle name color in usetargets
This commit is contained in:
parent
cf8742c4fe
commit
cd3e1aab4f
@ -8,6 +8,12 @@ game::DrivableVehicle::DrivableVehicle(World& world, const VehicleTuning& tuning
|
|||||||
OnPhysicsChanged();
|
OnPhysicsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void game::DrivableVehicle::SetTuning(const VehicleTuning& tuning)
|
||||||
|
{
|
||||||
|
Super::SetTuning(tuning);
|
||||||
|
UpdateUseTargetNames(); // to update vehicle color in usetarget names
|
||||||
|
}
|
||||||
|
|
||||||
void game::DrivableVehicle::OnPhysicsChanged()
|
void game::DrivableVehicle::OnPhysicsChanged()
|
||||||
{
|
{
|
||||||
// make body usable
|
// make body usable
|
||||||
@ -94,9 +100,6 @@ static std::string GetColorTextPrefix(uint32_t color)
|
|||||||
|
|
||||||
void game::DrivableVehicle::InitSeats()
|
void game::DrivableVehicle::InitSeats()
|
||||||
{
|
{
|
||||||
uint32_t color = GetTuningResult().colors[0];
|
|
||||||
std::string prefix = "vlízt do " + GetColorTextPrefix(color) + GetModelName() + "^r";
|
|
||||||
|
|
||||||
const auto& veh = *GetModel();
|
const auto& veh = *GetModel();
|
||||||
for (char c = '0'; c <= '9'; ++c)
|
for (char c = '0'; c <= '9'; ++c)
|
||||||
{
|
{
|
||||||
@ -110,6 +113,19 @@ void game::DrivableVehicle::InitSeats()
|
|||||||
seats_.emplace_back(seat);
|
seats_.emplace_back(seat);
|
||||||
|
|
||||||
uint32_t id = seats_.size() - 1;
|
uint32_t id = seats_.size() - 1;
|
||||||
use_targets_.emplace_back(this, id, seat.position, prefix + " (místo " + std::to_string(id + 1) + ")");
|
use_targets_.emplace_back(this, id, seat.position, std::string());
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateUseTargetNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
void game::DrivableVehicle::UpdateUseTargetNames()
|
||||||
|
{
|
||||||
|
uint32_t color = GetTuningResult().colors[0];
|
||||||
|
std::string prefix = "vlízt do " + GetColorTextPrefix(color) + GetModelName() + "^r";
|
||||||
|
|
||||||
|
for (auto& target : use_targets_)
|
||||||
|
{
|
||||||
|
target.desc = prefix + " (místo " + std::to_string(target.id + 1) + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,8 @@ public:
|
|||||||
|
|
||||||
DrivableVehicle(World& world, const VehicleTuning& tuning);
|
DrivableVehicle(World& world, const VehicleTuning& tuning);
|
||||||
|
|
||||||
|
virtual void SetTuning(const VehicleTuning& tuning) override;
|
||||||
|
|
||||||
virtual void OnPhysicsChanged() override;
|
virtual void OnPhysicsChanged() override;
|
||||||
|
|
||||||
virtual bool QueryUseTarget(PlayerCharacter& character, uint32_t target_id, UseTargetQueryResult& res) override;
|
virtual bool QueryUseTarget(PlayerCharacter& character, uint32_t target_id, UseTargetQueryResult& res) override;
|
||||||
@ -34,6 +36,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void InitSeats();
|
void InitSeats();
|
||||||
|
void UpdateUseTargetNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<VehicleSeat> seats_;
|
std::vector<VehicleSeat> seats_;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
void SetSteering(bool analog, float value = 0.0f);
|
void SetSteering(bool analog, float value = 0.0f);
|
||||||
|
|
||||||
void SetTuning(const VehicleTuning& tuning);
|
virtual void SetTuning(const VehicleTuning& tuning);
|
||||||
|
|
||||||
const std::string& GetModelName() const { return tuning_.model; }
|
const std::string& GetModelName() const { return tuning_.model; }
|
||||||
const std::shared_ptr<const assets::VehicleModel>& GetModel() const { return model_; }
|
const std::shared_ptr<const assets::VehicleModel>& GetModel() const { return model_; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user