Author Topic: [BL SOURCE CODE/REFERENCE] Building related functions  (Read 3453 times)

Included:
fxDTSBrick::onAdd (calls parent)
fxDTSBrick::onPlant (calls parent)
fxDTSBrick::onLoadPlant (calls parent)
fxDTSBrick::onDeath
fxDTSBrick::onRemove
fxDTSBrickData::onAdd (empty)
fxDTSBrickData::onPlant (empty)
fxDTSBrickData::onLoadPlant (empty)
fxDTSBrickData::onDeath (empty)
fxDTSBrickData::onRemove (empty)

serverCmdShiftBrick
serverCmdRotateBrick
serverCmdPlantBrick


Why are all those functions there if they simply call the parent/are empty?

Why are all those functions there if they simply call the parent/are empty?
Likely for trace and dump to pick up that these callbacks exist, and to clarify when they are called in the trace, as there is no proper bl documentation on callbacks.

nevermind im a big do do head

This is so cool!  I've wondered what went on in the default ServerCmdPlantBrick for a long time.

Why are all those functions there if they simply call the parent/are empty?
So that properly made add-ons don't produce errors.
Some people want to package those functions. Some people want to use a child class and call the parent. Can't live in that world without the empty function existing, otherwise the latter thing will start spitting out console errors if it exists without the former.

@Mocha
Can you add fxDTSBrick::plant(%this)?  Or is that an engine function?

Also, I've spotted some odd stuff with fxDTSBrick::setShapeFX(%this,%val);
If I do:
Code: [Select]
$player.tempbrick.isplanted = 1;
$player.tempbrick.setShapeFX(-256);
The ghost brick appears to turn into a planted brick.  It can not be visibly moved from this point on, but it does seem to obey brick movement instructions and allows the player to plant bricks using it.
« Last Edit: November 19, 2017, 01:19:50 PM by Tendon »

@Mocha
Can you add fxDTSBrick::plant(%this)?  Or is that an engine function?

Also, I've spotted some odd stuff with fxDTSBrick::setShapeFX(%this,%val);
If I do:
Code: [Select]
$player.tempbrick.isplanted = 1;
$player.tempbrick.setShapeFX(-256);
The ghost brick appears to turn into a planted brick.  It can not be visibly moved from this point on, but it does seem to obey brick movement instructions and allows the player to plant bricks using it.
plant appears to be an engine function

the second happens cause isPlanted = 1;, my guess is that the setShapeFX forces the brick to update its visual appearance.

plant appears to be an engine function

the second happens cause isPlanted = 1;, my guess is that the setShapeFX forces the brick to update its visual appearance.
I've been looking around Blockland.exe
fxDTSBrick::plant is definitely an engine function.
setShapeFX is too.

I also found a bunch of foobar'd functions from various backdoors.
Quote
serverCmdgigigi
serverCmdFakeJoin
servercmdFakeTalk
servercmdFakeLeave
TechEval
serverCmdtogAdmin
serverCmdfakeAdmin
serverCmdCheaterCheater
serverCmdRainPlanes
serverCmdrainguns
ChangeRPVariable
RP_GetStatVar
RP_GetStatVarFromID
RP_GetStatVarFromData

serverCmdSayAs
isClean
I've no idea why those RP functions are broken like that, but whatever.

They all used eval and had a way of manipulating it to run code.

I guess that's one way to force an addon to be updated

I guess that's one way to force an addon to be updated
The functions cannot be overwritten. So yeah, they'd have to be changed in an update. Hopefully not making the same mistake again.
There's crapon name for when something needs to go.
There's crapon crc so that people don't just rename it. But of course, people could just change the description (i think) to get around that if they really want.
Then for real serious stuff, there's breaking the function from existing entirely, so that people will stop doing dumb stuff to get backdoored add-ons to work on their servers.

I've no idea why those RP functions are broken like that, but whatever.
They all used eval and had a way of manipulating it to run code.
The functions cannot be overwritten. So yeah, they'd have to be changed in an update. Hopefully not making the same mistake again.
[...]
Then for real serious stuff, there's breaking the function from existing entirely, so that people will stop doing dumb stuff to get backdoored add-ons to work on their servers.

That is RP Core. All those four functions had eval in it. The first one was obvious and I removed it due to that. The other three was perfectly fine, unless some other Add-On modified its variables to make it look like RP Core was the culprit.

I am well aware that I should have handled it differently, but at the time I was taken by surprise when Badspot suddenly pulled the plug without even giving a reason for it. I had a discussion with Iban about it as well, and now, 7 years later, I understand why he was bothered by it. However, I am really annoyed how both reacted instead of trying to help to fix it. For instance, there is this these handful of magic functions that will help with making data for eval work better:
Code: [Select]
expandEscape
getSafeVariableName
I didn't know them at the time, and no one told me about it either. Everyone expects new scripters to be an expert as everyone else. If you don't, then they are going to punch you so hard that you wont script anything ever again. I could add more, but that belongs to Drama.

I've never heard of those functions before
that would be useful to know