2023-07-24 06:50:18 -04:00
|
|
|
AddCSLuaFile()
|
|
|
|
DEFINE_BASECLASS("base_wire_entity") -- for now?
|
|
|
|
ENT.PrintName = "LCPU"
|
|
|
|
ENT.Author = "Lily <3"
|
|
|
|
-- no more, this deeply uses native APIs
|
|
|
|
if CLIENT then return end
|
|
|
|
|
|
|
|
function ENT:Initialize()
|
|
|
|
self:PhysicsInit(SOLID_VPHYSICS)
|
|
|
|
self:SetMoveType(MOVETYPE_VPHYSICS)
|
|
|
|
self:SetSolid(SOLID_VPHYSICS)
|
|
|
|
-- 64 kb of ram for now.
|
2023-07-24 20:17:07 -04:00
|
|
|
self.cpu = LCPUNative.CreateCPU(128 * 1024)
|
2023-07-24 06:50:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:Think()
|
2023-07-24 20:17:07 -04:00
|
|
|
--
|
|
|
|
if not self.cpu:PoweredOn() then return end
|
|
|
|
|
2023-07-24 06:50:18 -04:00
|
|
|
self.cpu:Cycle()
|
|
|
|
-- Even though this is gated by tickrate I'm just trying to be nice here
|
|
|
|
self:NextThink(CurTime() + 0.1)
|
|
|
|
end
|