Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2021-10-08 00:00:00Z and 2021-10-09 00:00:00Z
Avatar
Hi i have two questions 1- in ddnet source in server side how can i change color of feet and body color 2- how can i change healt of player?
Avatar
Color you'd do by editing the color values in the CPlayer instance
10:23
The health you'd do in the CCharacter instance associated with the CPlayer
Avatar
Avatar
Learath2
Color you'd do by editing the color values in the CPlayer instance
I cant find body color in Cplayer
10:55
why there isn't good reference to how figure out ddnet source
Avatar
Avatar
KoroshKv
I cant find body color in Cplayer
use get character
Avatar
Avatar
KoroshKv
I cant find body color in Cplayer
It's in m_TeeInfos
Avatar
Avatar
Anime.pdf
use get character
Avatar
ah yes nvm get back to player and change m_TeeInfos
11:02
pPlayer->m_TeeInfos.m_ColorFeet
11:02
or whatever u need
Avatar
Avatar
KoroshKv
why there isn't good reference to how figure out ddnet source
No one wrote it, so no docs. Such is the nature of an organically growing codebase with only volunteer work
Avatar
Avatar
Anime.pdf
pPlayer->m_TeeInfos.m_ColorFeet
thanks and how can i change healt? (edited)
Avatar
Avatar
Learath2
No one wrote it, so no docs. Such is the nature of an organically growing codebase with only volunteer work
thnks
11:08
: (
Avatar
Ah that color is sadly not a ColorRGBA or a ColorHSLA. Its a legacy tw color
11:12
You need to call the member method Pack. You can check out how I did it in teeinfo.cpp
Avatar
Avatar
KoroshKv
thanks and how can i change healt? (edited)
healt?
Avatar
Health
Avatar
Avatar
Learath2
Health
yes
Avatar
pPlayer->GetCharacter()->IncreaseHealth(-5);
11:14
pass negative to deal damage
11:14
ok some kind of it
Avatar
Don't work 😦
Avatar
show your code
Avatar
Avatar
Fän
show your code
void ToggleSpecPause(IConsole::IResult *pResult, void *pUserData, int PauseType) { if(!CheckClientID(pResult->m_ClientID)) return; CGameContext *pSelf = (CGameContext *)pUserData; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; pPlayer->GetCharacter()->IncreaseHealth(-5); }
Avatar
Eh, I can take a look when I get back but there should be a loop somewhere that keeps setting it back to 10
Avatar
Avatar
Learath2
Eh, I can take a look when I get back but there should be a loop somewhere that keeps setting it back to 10
thnks
Avatar
Avatar
KoroshKv
void ToggleSpecPause(IConsole::IResult *pResult, void *pUserData, int PauseType) { if(!CheckClientID(pResult->m_ClientID)) return; CGameContext *pSelf = (CGameContext *)pUserData; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; pPlayer->GetCharacter()->IncreaseHealth(-5); }
afair increase health clamps input
12:48
check it out
Avatar
Avatar
gerdoe
check it out
clamp(-5, 0, 10);? (edited)
12:50
okey wait i should check what increasehealth does
Avatar
thnks
Avatar
yeah as i supposed
12:53
you should set health manually instead of use increasehealth
12:55
add new function to ccharacter named SetHealth(int Amount) with setting m_Health = clamp(m_Health + Amount, 0, 10);
12:56
ir just delete first if statement in increasehealth if you don't want to add anything
12:56
or*
Avatar
Avatar
gerdoe
or*
thans i fixed this problem
Avatar
chillerdragon BOT 2021-10-08 15:19:53Z
bro @Deleted User can you just send correct code for https://github.com/ddnet/ddnet/pull/4173#issuecomment-938046483i am super confused. Why should the string getter be responsible for reallocating memory? Shouldn't that happen already when getting the data. And how is this no issue for the json version?
Adds ResultStr() which returns a null terminated string. So the http code can be used to do plaintext requests not only json. Checklist Tested the change ingame Provided screenshots if it is a v...
Avatar
so a string needs a null termination in C
15:28
the json library is special in that it doesn't need that null termination
justatest 1
Avatar
hm, why?
15:28
it stores length of string?
Avatar
c++ json_value *CGet::ResultJson() const { unsigned char *pResult = Result(); if(!pResult) { return NULL; } return json_parse((char *)pResult, m_BufferLength); }
15:29
yes
Avatar
interesting move tho
Avatar
Jupstar ✪ BOT 2021-10-08 15:39:20Z
well what should i fix? I personally would just implement a Job that fetches text data, that also wouldnt require to be in the ddnet code Else i would take a buffer as parameter, e.g. a std::string and fill that on demandIf you absolutly dont want todo it, change the buffer reallocation as i said in the comment(imo the worst solution, bcs it's not intuitive)
Avatar
damn jupeyy has also graduated from discord
15:40
in 2030 this entire channel will move from discord and we can remove the bridge troll
Avatar
Jupstar ✪ BOT 2021-10-08 15:40:48Z
yes, but not bcs of ddnet ;)
Avatar
if you put the null termination next to the buffer re-allocation, then it's not so bad
15:41
but leave a comment then why ResultStr() is safe ^^
Avatar
@heinrich5991
18:28
you there? (edited)
18:29
@Ryozuki
18:29
where do i change words
Avatar
for example
18:29
18:30
"geist" to "cheats"
18:31
found it
Exported 65 message(s)