Adds sized (S, M, L) power cells and a generic component for battery powered items (#2352)
* Refactor battery/powercell assets and add new ones. * committing before I fuck things up * slot component doned I think * dictionary update * Fixes * Moving flashlight to powerslotcomponent * har har i am using the message tubes * Better documentation comment * Reverting this overengineered garbage. * Off with ye I said * Examine texts. * Some minor fixes to IDE complaints * slot size from yaml * Ignored component + removing a useless typo entry * Making stunbatons use this * Handle the message and remove some unnecessary dirtiness * actionblocker checks * remove unused file * remove updatevisual * make these nullable * make these nullable too * Unrename sprite folder * check itemcomponent on insertion * Use SendMessage over Owner.SendMessage * Add support for auto-recharging batteries, an auto-recharging cell, and make flashlight status update correctly if one is inserted in it. * get rid of public fields which are Bad * add a description for the stun baton while i'm in here * one more public field * Add the blinky animation to the atomic cell * Fix the charge indicator being STUPID * better comments * this is a better function * add pause for flashlight, remove unnecessary imports from battery * potato battery copyright link * WHO DID THAT * mr clean has come * Random pitch * pausing * round to nearest levels
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Utility;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
@@ -88,23 +89,27 @@ namespace Content.Client.GameObjects.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
level = 1 + (int) MathF.Round(charge * 6);
|
||||
level = ContentHelpers.RoundToNearestLevels(charge, 1.0, 6) + 1;
|
||||
}
|
||||
|
||||
if (level == 1)
|
||||
if (level == 0)
|
||||
{
|
||||
_sections[0].PanelOverride = _styleBoxUnlit;
|
||||
}
|
||||
else if (level == 1)
|
||||
{
|
||||
// Flash the last light.
|
||||
_sections[0].PanelOverride = _timer > TimerCycle / 2 ? _styleBoxLit : _styleBoxUnlit;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sections[0].PanelOverride = level > 2 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[0].PanelOverride = _styleBoxLit;
|
||||
}
|
||||
|
||||
_sections[1].PanelOverride = level > 3 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[2].PanelOverride = level > 4 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[3].PanelOverride = level > 5 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[4].PanelOverride = level > 6 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[1].PanelOverride = level >= 3 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[2].PanelOverride = level >= 4 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[3].PanelOverride = level >= 5 ? _styleBoxLit : _styleBoxUnlit;
|
||||
_sections[4].PanelOverride = level >= 6 ? _styleBoxLit : _styleBoxUnlit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user