Callbacks and funcs

Updated 11 months ago

一些回调New callbacks

如果你不是开发者,略过这里。
Ignore this part if you dont want to develop.

我修改了下面这个文件,增加了三个回调函数。
cl_obituary.gnut was modified. 3 callbcacks added.

AddCallback_Obituary( array<string> functionref( entity, entity, array<string> ) callbackFunc )

Added with Obituary( entity attacker, string attackerClass, entity victim, int scriptDamageType, int damageSourceId, bool isHeadShot, bool victimIsOwnedTitan = false, bool forceDisplay = false )

Obituary is created in that function.

这是用来修改击杀信息中人名的。
This mod use this to modify the attacker/victim names.

void function AddCallback_Obituary( array<string> functionref( entity, entity, array<string> ) callbackFunc )

AddCallback_PrintObituary( void functionref( ObitStringData ) callbackFunc )

Added with void function Obituary_Print( string attackerDisplayName, string weaponDisplayName, string victimDisplayName, vector attackerColor, vector weaponColor, vector victimColor, weaponIcon = null, string attackerPetDisplayName = "", string victimPetDisplayName = "" )

我不知道干嘛的,但是寻思可以这样写。
Actually I don’t know what this function used for. If you wanna modify the obituary, don’t use this.

void function AddCallback_PrintObituary( void functionref( ObitStringData ) callbackFunc )

AddCallback_PrintObituaryLocalized( string functionref( string ) callbackFunc )

Added with void function Obituary_Print_Localized( string localizedPrint, vector altColor1 = <255, 255, 255>, vector altColor2 = <255, 255, 255>, vector altColor3 = <255, 255, 255>, vector backgroundColor = <255, 255, 255>, float backgroundAlpha = 0.0 )

The Obituary(...) will call Obituary_Print_Localized(...). The obituary string will be localized here.

可以用来修改击杀信息中的武器名称。
If you wanna modify the weapon names in obituary, may you can use this.

void function AddCallback_PrintObituaryLocalized( string functionref( string ) callbackFunc )

新的别的函数New Functions

我不知道为什么,它们有时候会报错。但我认为玩家名称中应该不具有ASCII表外的字符,又或者我写错了那张表?
I dont know why these func sometimes get error. There should be only ascii chars in the names. Did I get wront with this?

// 返回字符的Ascii码
// Return the ascii code of a char in string. Return -1, if the string.len() != 1
int function Ord(string c)

// 从Ascii码得到字符
// Return the char.
string function Chr(int code)