Skip to content
dounai2333 edited this page Dec 31, 2024 · 8 revisions

Introduction

The usage of dounai_lib is not like other third-party libs, after require("dounai-lib"), it will only return true.

Instead, a global dounai_lib variable is set, with everything in it, when calling a function from dounai_lib, you should use it like this:

-- Directly use the function.
local entities = dounai_lib.ents.GetAll()
local newEntity = dounai_lib.ents.Create("weapon_ak47")

OR

-- Create another variable for easier coding.
local ents = dounai_lib.ents
local entities = ents.GetAll()
local newEntity = ents.Create("weapon_ak47")

New stuff provided in default

These are "install to working", doesn't need extra code or function calls!

Grenade Trails

When player throw a grenade, there will be a trail following the grenade projectile.

By default, the he grenade come with red color, and the flashbang is white, smoke grenade is green.

This feature can be disabled by a global switch: dounai_lib.feature.GrenadeTrails.enable = false.

Non-Networked Entities

Come in handy server-side only entities (CServerOnlyEntity: "env_fade", "filter_activator_team" and "math_counter" etc) support, now you can get them normally by using Entity(index) or original GetEntityByIndex(index), with all entity APIs working!

EventManager:RegisterTimer

The delay parameter now support using decimal point, you can use 0.5 or 2.9 seconds as delay without issue.

Only 1 timer can be triggered in single tick is also fixed.

grenade_bounce

The event will no longer use "userid" as argument, instead, it has been replaced to "pointer", which is the pointer address of the grenade projectile itself.

By giving the pointer to dounai_lib.c.GetEntityIndexByPointer(), you can get the entity index without unnecessary code.

As a additional changes, "x" "y" "z" arguments has been restored, they are the origin of the entity.

print

By overriding bulit-in print() function, now using print("Hello World!") will print the message directly to your console.

printf("Hello %s!", "World") is also available.

Other Changes

Block the chat message ("say" and "say_team" commands) that will send to the other players. They are useless for normal players, but useful for programmer.

Game events can now be created and fired even there is no listener attach to it, this is mainly for debugging (net_showevents 2).

Clone this wiki locally