Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------
- --If you don't want to see the temperature, change the following "true" to "false":
- ------------------------------------------
- local displaytemperature=true
- -------------------------------------------
- --Unless you know what you're doing, LEAVE EVERYTHING BELOW THIS LINE ALONE
- -------------------------------------------
- require = GLOBAL.require
- local Text = require "widgets/text"
- local Widget = require "widgets/widget"
- local Badge = require "widgets/badge"
- local mybadgelosefocus = Badge.OnLoseFocus
- function Badge:OnLoseFocus()
- local asdf = mybadgelosefocus(self)
- self.isfocused=false
- if self.num then
- self.num:Show()
- end
- if self.num2 then
- self.num2:Hide()
- end
- return asdf
- end
- local mybadgegainfocus = Badge.OnGainFocus
- function Badge:OnGainFocus()
- local asdf = mybadgegainfocus(self)
- self.isfocused=true
- if self.num then
- self.num:Hide()
- end
- if self.num2 then
- self.num2:Show()
- end
- return asdf
- end
- local mysetpercent = Badge.SetPercent
- function Badge:SetPercent(val,max)
- local asdf = mysetpercent(self, val, max)
- if self.num then
- if not self.isfocused then
- self.num:Show()
- else
- if self.isfocused==false then
- self.num:Show()
- end
- end
- end
- if not self.num2 then
- self.num2 = self:AddChild(Text(GLOBAL.BODYTEXTFONT, 33))
- self.num2:SetHAlign(GLOBAL.ANCHOR_MIDDLE)
- self.num2:SetPosition(5, 0, 0)
- self.num2:Hide()
- end
- self.num2:SetString(tostring(max))
- return asdf
- end
- --temperature:
- local UIClock=require"widgets/uiclock"
- local myclockupdate=UIClock.UpdateDayString
- function UIClock:UpdateDayString()
- local asdf=myclockupdate(self)
- if displaytemperature==true then
- self.text:SetPosition(5, 3/self.base_scale, 0)
- if not self.text2 then
- self.text2 = self:AddChild(Text(GLOBAL.BODYTEXTFONT, 25/self.base_scale))
- self.text2:SetPosition(5, -23/self.base_scale, 0)
- local temper=tostring(GLOBAL.GetPlayer().components.temperature.current or "?")
- self.inst:DoPeriodicTask(0, function(inst)
- temper=tostring(GLOBAL.GetPlayer().components.temperature.current or "?")
- temper=math.floor(temper)
- self.text2:SetString(temper.."\176C")
- end)
- end
- end
- return asdf
- end
- --rain meter:
- AddSimPostInit(function(inst)
- if (GLOBAL.IsDLCEnabled(1)) then
- local MoistureMeter = require "widgets/moisturemeter"
- local mymoistureact = MoistureMeter.Activate
- function MoistureMeter:Activate()
- local asdf = mymoistureact(self)
- if self.num then
- self.num:Show()
- end
- return asdf
- end
- local mymoisturedeact = MoistureMeter.Deactivate
- function MoistureMeter:Deactivate()
- local asdf = mymoisturedeact(self)
- if self.num then
- self.num:Hide()
- inst:DoTaskInTime(.25, function(inst)
- self.num:Hide()
- end)
- end
- return asdf
- end
- local mymoisturelosefoc = MoistureMeter.OnLoseFocus
- function MoistureMeter:OnLoseFocus()
- local asdf = mymoisturelosefoc(self)
- if self.num then
- self.num:Show()
- end
- return asdf
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement