Skip to content

Conversation

emre1702
Copy link
Contributor

@emre1702 emre1702 commented Nov 10, 2017

You should be able to clone ColShapes with that.

Before someone asks why I didn't overload the "=" operator:
The CColManager-field is private (dunno why). Wasn't sure if I could make it public without any problems.
If it wouldn't be a problem, it's not really hard to change it.
Oh and I'm pretty new to C++, I think I could have overrided the copy constructor, too.

Oh and it's only tested in the server-console.
Got problems with joining in the game.

Bugtracker: https://bugs.mtasa.com/view.php?id=8193

@CrosRoad95
Copy link

people said that clone is buggy and should be disabled.
I dont think that clone is better then create new colshape, more usefull would be functions to modify existed colshapes

@emre1702
Copy link
Contributor Author

Clone doesn't seem to be buggy for me, just not completed (oh and the bug that they won't get removed on resource stop got already fixed).
Cloning colshapes is the same as creating a new one, using same parent, same position, same height, same radius, same width, same dimension and same interior (oh and CustomDataPointer, dunno what that is).
So it's much shorter if you just want to create the same colshape on the same position.
Then you can change it a bit (move it a bit more right, in another dimension etc.).

O and the bug is marked as "confirmed" and in the roadmap for MTA 1.6.

@Citizen01
Copy link
Member

(oh and CustomDataPointer, dunno what that is)

It's where all setElementData go and it is logical to duplicate it too:

local col1 = createColSphere(0, 0, 0, 10)
setElementData(col1, "price", 20)
local col2 = cloneElement(col1)
local price = getElementData(col2, "price")
-- Here 'price' should be equal to 20

Also I would add a break at the end of your CElement::COLSHAPE case.

@Samake
Copy link

Samake commented Nov 10, 2017

Receiving cloned colshapes events of the original col too? This would be nice.

@Citizen01
Copy link
Member

@Samake No, it is not cloning handlers of an event (if you were talking about that), and actually I think it should not. They are not cloned for other "clonable" element types like markers and pickups so one should expect the same behavior for the colshape type.

@emre1702
Copy link
Contributor Author

@Citizen01 Thanks for both infos - fixed it.

@Necktrox Necktrox added the enhancement New feature or request label Nov 15, 2017
@qaisjp
Copy link
Contributor

qaisjp commented Jul 1, 2018

Unfortunately we can't view the diff, and so we can't look into merging this. Do you have a backup @emre1702?

@qaisjp qaisjp added the feedback Further information is requested label Jul 1, 2018
@emre1702
Copy link
Contributor Author

emre1702 commented Jul 1, 2018

No, better close.
Will work on it again.

@emre1702 emre1702 closed this Jul 1, 2018
@patrikjuvonen
Copy link
Contributor

Waits for #182

@patrikjuvonen patrikjuvonen removed pr:needs-testing feedback Further information is requested labels Aug 7, 2018
@patrikjuvonen patrikjuvonen changed the title (#8193) Add possibility to clone ColShape. 0008193: Add possibility to clone ColShape Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants