Hi. I want to look at the source code of the some default entites like item_healthcharger. How I can do this? Thx
[QUOTE=_AMD_;48453056]Hi. I want to look at the source code of the some default entites like item_healthcharger. How I can do this? Thx[/QUOTE]
You can see SOME of them here:
[url]https://github.com/ValveSoftware/source-sdk-2013[/url]
Not not all of them.
You can find source of all Lua entities here:
[url]https://github.com/garrynewman/garrysmod/tree/master/garrysmod[/url]
-snip f you robot for ninjaing jk bby-
[QUOTE=Robotboy655;48453069]
You can find source of all Lua entities here:
[url]https://github.com/garrynewman/garrysmod/tree/master/garrysmod[/url][/QUOTE]
Ok. Where is item_healthcharger?
Is it too hard to use search?
Edit: fucked up the line number, updated.
[URL]https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/hl2/item_healthkit.cpp#L420[/URL]
[QUOTE=mijyuoon;48453123]Is it too hard to use search?
Edit: fucked up the line number, updated.
[URL]https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/hl2/item_healthkit.cpp#L420[/URL][/QUOTE]
Я использовал поиск. И это не исходник чарджера. Так или иначе я не вижу по этому исходнику как он работает
[QUOTE=_AMD_;48453148]Я использовал поиск. И это не исходник чарджера[/QUOTE]
[code]
class CNewWallHealth : public CBaseAnimating
...
LINK_ENTITY_TO_CLASS( item_healthcharger, CNewWallHealth);
[/code]
А это что тогда?
[code]
// charge the player
if ( pActivator->TakeHealth( 1, DMG_GENERIC ) )
{
m_iJuice--;
}
[/code]
Ninja'd
[code]LINK_ENTITY_TO_CLASS( item_healthcharger, CNewWallHealth);[/code]
Yes it is
[QUOTE=mijyuoon;48453159][code]
class CNewWallHealth : public CBaseAnimating
...
LINK_ENTITY_TO_CLASS( item_healthcharger, CNewWallHealth);
[/code]
А это что тогда?
[code]
// charge the player
if ( pActivator->TakeHealth( 1, DMG_GENERIC ) )
{
m_iJuice--;
}
[/code][/QUOTE]
Хрен его знает. На Lua как запилить, чтобы хп выдавалось медленнее?
[code]
function ENT:Use(activator)
local maxhealth = activator:GetMaxHealth() or 100
if activator:Health() < maxhealth then
activator:SetHealth(activator:Health() + 1)
self:EmitSound("hl1/fvox/boop.wav", 150, activator:Health() / maxhealth * 100, 1, CHAN_AUTO)
end
end
[/code]
[code]
function ENT:Initialize()
self.LastFired = 0
self.Delay = 0.1
end
function ENT:Use(act)
if self.LastFired <= CurTime() then
self.LastFired = CurTime() + self.Delay
-- code here
end
end
[/code]
please use english on an english forum
[editline]a[/editline]
i just want to stalk this thread in english
[QUOTE=mijyuoon;48453224][code]
function ENT:Initialize()
self.LastFired = 0
self.Delay = 0.1
end
function ENT:Use(act)
if self.LastFired <= CurTime() then
self.LastFired = CurTime() + self.Delay
-- code here
end
end
[/code][/QUOTE]
Спасибо. У меня еще такой способ сработал, но кажется, так не правильно делать :)
[code]
local LastUse = CurTime() - 1
function ENT:Use(activator)
if LastUse < CurTime() then
-- code
LastUse = CurTime() + 0.15
end
end
[/code]
[QUOTE=MeepDarknessM;48453281]please use english on an english forum[/QUOTE]
Solved :)
Sorry, you need to Log In to post a reply to this thread.