From e47104aa290ac6d73740990e6d64d2fc35ac2ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Mon, 22 Mar 2004 11:29:29 +0000 Subject: [PATCH] Fixed reference to find_ent_by_classname in find_ent Added set_entity_visibility and get_entity_visibility --- plugins/include/engine_stocks.inc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/include/engine_stocks.inc b/plugins/include/engine_stocks.inc index d5c2e18c..99cb8f11 100755 --- a/plugins/include/engine_stocks.inc +++ b/plugins/include/engine_stocks.inc @@ -14,7 +14,7 @@ //wrapper for find_ent_by_class stock find_ent(iStart, szClassname[]) { - return find_ent_by_classname(iStart, szClassname) + return find_ent_by_class(iStart, szClassname) } /* Changes an integer vec to a floating vec */ @@ -147,7 +147,7 @@ stock user_silentkill(index) return 1 } -/* Set rendering of an entity */ +/* Set endering of an entity */ stock set_rendering(index,fx=kRenderFxNone, r=255,g=255,b=255, render=kRenderNormal,amount=16) { entity_set_int(index,EV_INT_renderfx,fx) @@ -191,4 +191,22 @@ stock set_entity_flags(ent,flag,onoff) } return 0 +} + +/* If visible = 1, entity will be set to be visible, else invisible. */ +stock set_entity_visibility(entity, visible = 1) { + new effects = entity_get_int(entity, EV_INT_effects) + if (visible == 1) + effects &= ~EF_NODRAW + else + effects |= EF_NODRAW + + entity_set_int(entity, EV_INT_effects, effects) + + return 1 +} + +/* Returns 1 if entity is visible. */ +stock get_entity_visibility(entity) { + return (entity_get_int(entity, EV_INT_effects) & EF_NODRAW) } \ No newline at end of file