Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace WorldScript
- {
- [WorldScript color="#8fbc8f" icon="system/icons.png;64;384;32;32"]
- class ChangeScore : IWidgetHoster
- {
- TextWidget@ m_faggyWidget;
- TextWidget@ m_scoobyWidget;
- [Editable max=1 validation=IsVariable]
- UnitFeed Variable;
- bool IsVariable(UnitPtr unit)
- {
- return cast<Variable>(unit.GetScriptBehavior()) !is null;
- }
- bool IsExecutable(UnitPtr unit)
- {
- WorldScript@ script = WorldScript::GetWorldScript(unit);
- if (script is null)
- return false;
- return script.IsExecutable();
- }
- SValue@ ServerExecute()
- {
- auto variable = Variable.FetchFirst();
- if (!variable.IsValid())
- return null;
- Variable@ var = cast<Variable>(variable.GetScriptBehavior());
- bool result = false;
- m_scoobyWidget.SetText(var.Value);
- return null;
- }
- ChangeScore(GUIBuilder@ b)
- {
- GUIDef@ def = LoadWidget(b, "gui/hud/survival.gui");
- @m_faggyWidget = cast<TextWidget>(m_widget.GetWidgetById("faggy"));
- @m_scoobyWidget = cast<TextWidget>(m_widget.GetWidgetById("scooby"));
- }
- void Update(int dt) override
- {
- IWidgetHoster::Update(dt);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment