mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
48
lua/entities/stormfox_wiredata/cl_init.lua
Normal file
48
lua/entities/stormfox_wiredata/cl_init.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:GetOverlayText()
|
||||
return "StormFox wiremod support"
|
||||
end
|
||||
|
||||
local matBeam = Material( "effects/lamp_beam" )
|
||||
|
||||
local sf = Material("stormfox2/logo.png")
|
||||
local part = Material("effects/lamp_beam")
|
||||
local mat = Material("dev/dev_combinemonitor_3")
|
||||
local sin,abs = math.sin,math.abs
|
||||
local c = Color(0,0,0)
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
if ( halo.RenderedEntity() == self ) then return end
|
||||
if not StormFox2 then return end
|
||||
if not StormFox2.Loaded then return end
|
||||
|
||||
cam.Start3D2D(self:LocalToWorld(Vector(5.8,-5.11,0.82)),self:LocalToWorldAngles(Angle(0,90,90)),0.1)
|
||||
surface.SetDrawColor(0,0,0)
|
||||
surface.DrawRect(0,0,50,25)
|
||||
surface.SetMaterial(sf)
|
||||
surface.SetDrawColor(255,255,255)
|
||||
surface.DrawTexturedRect(15,2,20,20)
|
||||
surface.SetMaterial(mat)
|
||||
surface.SetDrawColor(255,255,255)
|
||||
surface.DrawTexturedRect(0,0,50,25)
|
||||
cam.End3D2D()
|
||||
|
||||
local p = self:LocalToWorld(Vector(5.9,0,0))
|
||||
local a = abs(sin(SysTime())) * 255
|
||||
render.SetColorMaterial()
|
||||
c.r = a
|
||||
render.DrawBox(p,self:GetAngles(),Vector(-0.1,-0.1,-0.1),Vector(0.1,0.1,0.1),c)
|
||||
render.SetMaterial(part)
|
||||
render.DrawBeam(p,p + self:GetForward() * 1,1,0,1,c)
|
||||
end
|
||||
105
lua/entities/stormfox_wiredata/init.lua
Normal file
105
lua/entities/stormfox_wiredata/init.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
-- Check if wiremod is installed
|
||||
if not file.Exists("lua/autorun/wire_load.lua", "GAME") then return end
|
||||
|
||||
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/props_lab/reciever01d.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
|
||||
self:SetSolid( SOLID_VPHYSICS ) -- Toolbox
|
||||
|
||||
self:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
|
||||
if WireAddon then
|
||||
self.Outputs = Wire_CreateOutputs(self, {
|
||||
"Temperature",
|
||||
"Temperature_F",
|
||||
"Rain_gauge",
|
||||
"Wind",
|
||||
"WindAngle",
|
||||
"Thunder",
|
||||
"Clock_24 [STRING]",
|
||||
"Clock_12 [STRING]",
|
||||
"Clock_raw",
|
||||
"Weather [STRING]"
|
||||
})
|
||||
Wire_TriggerOutput(self, "Clock_raw", StormFox2.Time.Get(true))
|
||||
Wire_TriggerOutput(self, "Clock_24", StormFox2.Time.TimeToString(nil))
|
||||
Wire_TriggerOutput(self, "Clock_12", StormFox2.Time.TimeToString(nil,true))
|
||||
local temp = StormFox2.Temperature.Get()
|
||||
Wire_TriggerOutput(self, "Temperature", temp)
|
||||
Wire_TriggerOutput(self, "Temperature_F",StormFox2.Temperature.Convert("fahrenheit","celsius",temp))
|
||||
local gauge = 0
|
||||
local wD = StormFox2.Weather.GetCurrent()
|
||||
if wD.Name == "Rain" or wD.Inherit == "Rain" then
|
||||
gauge = StormFox2.Weather.GetPercent() * 10
|
||||
end
|
||||
Wire_TriggerOutput(self, "Rain_gauge", gauge)
|
||||
Wire_TriggerOutput(self, "Wind", StormFox2.Wind.GetForce())
|
||||
Wire_TriggerOutput(self, "WindAngle", StormFox2.Wind.GetYaw())
|
||||
Wire_TriggerOutput(self, "Thunder", StormFox2.Thunder.IsThundering() and 1 or 0)
|
||||
Wire_TriggerOutput(self, "Weather", StormFox2.Weather.GetDescription())
|
||||
end
|
||||
self:SetKeyValue("fademindist", 2000)
|
||||
self:SetKeyValue("fademaxdist", 2000)
|
||||
end
|
||||
|
||||
local function SetWire(self,data,value)
|
||||
if self.Outputs[data].Value != value then
|
||||
Wire_TriggerOutput(self, data, value)
|
||||
end
|
||||
end
|
||||
|
||||
local l = 0
|
||||
function ENT:Think()
|
||||
if not WireAddon then return end
|
||||
if l > SysTime() then return end
|
||||
l = SysTime() + 1
|
||||
Wire_TriggerOutput(self, "Clock_raw", StormFox2.Time.Get(true))
|
||||
Wire_TriggerOutput(self, "Clock_24", StormFox2.Time.TimeToString(nil))
|
||||
Wire_TriggerOutput(self, "Clock_12", StormFox2.Time.TimeToString(nil,true))
|
||||
local temp = StormFox2.Temperature.Get()
|
||||
Wire_TriggerOutput(self, "Temperature", temp)
|
||||
Wire_TriggerOutput(self, "Temperature_F",StormFox2.Temperature.Convert("fahrenheit","celsius",temp))
|
||||
local gauge = 0
|
||||
local wD = StormFox2.Weather.GetCurrent()
|
||||
if wD.Name == "Rain" or wD.Inherit == "Rain" then
|
||||
gauge = StormFox2.Weather.GetPercent() * 10
|
||||
end
|
||||
Wire_TriggerOutput(self, "Rain_gauge", gauge)
|
||||
Wire_TriggerOutput(self, "Wind", StormFox2.Wind.GetForce())
|
||||
Wire_TriggerOutput(self, "WindAngle", StormFox2.Wind.GetYaw())
|
||||
Wire_TriggerOutput(self, "Thunder", StormFox2.Thunder.IsThundering() and 1 or 0)
|
||||
Wire_TriggerOutput(self, "Weather", StormFox2.Weather.GetDescription())
|
||||
end
|
||||
|
||||
function ENT:SpawnFunction( ply, tr, ClassName )
|
||||
|
||||
if ( !tr.Hit ) then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 3
|
||||
|
||||
local ent = ents.Create( ClassName )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:SetAngles(Angle(0,ply:EyeAngles().y + 180,0))
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
|
||||
end
|
||||
24
lua/entities/stormfox_wiredata/shared.lua
Normal file
24
lua/entities/stormfox_wiredata/shared.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_anim"
|
||||
|
||||
ENT.PrintName = "Wire-Weather Station"
|
||||
ENT.Author = "Nak"
|
||||
ENT.Purpose = "Allows wiremod to read weatherdata"
|
||||
ENT.Instructions = "Use wiremod on it"
|
||||
ENT.Category = "StormFox2"
|
||||
|
||||
ENT.Editable = true
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = false
|
||||
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
Reference in New Issue
Block a user