Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ENT.Type = "anim"
- ENT.Base = "base_gmodentity"
- ENT.PrintName = "Fish"
- ENT.Author = "Eryk"
- ENT.Information = "This is a nice fish"
- ENT.Category = "Fishing mod"
- ENT.Spawnable = false
- ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
- ENT.DeathTimer = FISHINGMOD.Config.DeathTimer or 10 -- seconds
- ENT.Speed = 5
- ENT.InWater = true
- ENT.HasBaitInMouth = false
- function ENT:SetupDataTables()
- self:NetworkVar( "Entity", 0, "FishSpot" )
- self:NetworkVar( "Int", 0, "SwimmingSpeed" )
- self:NetworkVar( "Int", 1, "Size" )
- self:NetworkVar( "Float", 3, "Tiredness" )
- self:NetworkVar( "Bool", 0, "HasBaitInMouth" )
- self:NetworkVar( "Vector", 0, "DirectionPos" )
- //For the client fish
- self:NetworkVar( "Int", 2, "Speed" )
- self:NetworkVar( "String", 0, "ClientsideModel")
- self:NetworkVar( "String", 1, "FishName" )
- self:NetworkVar( "Vector", 1, "CurrentPos" )
- self:NetworkVar( "Bool", 1, "Death" )
- end
- ENT.FISH = {}
- local lang = FISHINGMOD.Language
- function ENT.FISH:Draw()
- self:DrawModel()
- local ply = LocalPlayer()
- local pos = self:GetPos()
- local ang = self:GetAngles()
- local min = select(1, self:GetCollisionBounds())
- local max = select(2, self:GetCollisionBounds())
- local len_height = math.sqrt(min.z^2 + max.z^2)
- if (len_height < 5) then len_height = 10 end
- if (ply:GetPos():Distance(pos) < 150) then
- cam.Start3D2D(pos, Angle(-90, LocalPlayer():GetAngles().y, 0) - Angle(90, -90, 90), 0.025)
- surface.SetFont( "fishingmod_2d3d_font" )
- local name = lang:Translate(self:GetParent():GetFishName())
- local textposx, textposy = surface.GetTextSize(name)
- surface.SetDrawColor( 0, 0, 0, 230 )
- draw.RoundedBox( 32, -textposx * 1.5 - (-textposx * 1.5) / 2, len_height * -54, textposx * 1.5, 25 * 5, Color(25,25,25,200))
- surface.SetTextColor( 255, 255, 255, 255 )
- surface.SetTextPos((textposx / 2) - textposx, len_height * -50 * 1.07)
- surface.DrawText(name)
- cam.End3D2D()
- end
- end
- function ENT.FISH:RenderOverride()
- self:Draw()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement