-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formation #1
base: master
Are you sure you want to change the base?
Conversation
charmer->GetFormationSlot()->GetFormationData()->Add(m_player); | ||
} | ||
else | ||
m_player->GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is multiple of these, maybe handle it in MoveFollow? Player based quasi formation also needs the same logic, when you lets say have army of the dead in wotlk or multiple guardians and hunter pet, they should all dynamically calculate angle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well first at this stage formation is a sub option for creaturegroup meaning that formation need a creature group absolutly and its designed only for creature as leader.
Thus some big change have to be done to be able to make a player as a master and more to have some other kind of group that will be attached to player.
Secondly you are asking for more than just adding it as exception of the movefollow we had a discussion about it with tobi and it seem that movefollow should even been replaced by some 'move in formation' with position computed depending of the player's followers.
src/game/Chat/Level2.cpp
Outdated
SendSysMessage("Error: unable to retrieve the slot of the creature."); | ||
} | ||
|
||
SendSysMessage(gData->to_string().c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non standard way of things. Compiler will scream. Do PSendSys and format specifier %s and pass it as arg 1.
return false; | ||
} | ||
|
||
if (formationId >= static_cast<uint32>(SpawnGroupFormationType::SPAWN_GROUP_FORMATION_TYPE_COUNT)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primitives are best typecasted as c-style cast, since they arent really heresy. Curious choice of enum class, shauren loves them, buuuut historically in cmangos they seem out of place. Not really opposed to it tho.
src/game/DBScripts/ScriptMgr.cpp
Outdated
case 2: // SetFormation | ||
{ | ||
|
||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brackets unnecessary with only break
src/game/DBScripts/ScriptMgr.cpp
Outdated
{ | ||
if (m_script->textId[0] == 1) | ||
{ | ||
auto respPos = creature->GetRespawnPosition(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shauren kindly explained to me not to use auto like this. I know what the type is, but anyone else reviewing wont. So in these cases dont use auto and put Position there. Its bad when doing it in github interface, i.e. bad for OS. I use it mainly for pairs, tuples, iterators and other templated nonsense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazyness spotted you are correct
src/game/DBScripts/ScriptMgr.cpp
Outdated
|
||
Creature* leader = static_cast<Creature*>(pTarget); | ||
|
||
auto groupData = leader->GetCreatureGroup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same point here, I have no fkin clue what it should be :D
src/game/DBScripts/ScriptMgr.cpp
Outdated
if (LogIfNotCreature(pSource)) | ||
return false; | ||
|
||
CreatureGroup* grpData = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grpData and later groupData, quite confusing variable choice
src/game/DBScripts/ScriptMgr.cpp
Outdated
|
||
switch (m_script->formationData.command) | ||
{ | ||
case 2: // set formation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing indent
src/game/DBScripts/ScriptMgr.cpp
Outdated
break; | ||
} | ||
|
||
FormationEntrySPtr fEntry = std::make_shared<FormationEntry>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be shared ptr at entry level and not at global level. Not inherently wrong just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum yes maybe not needed too here
src/game/DBScripts/ScriptMgr.cpp
Outdated
break; | ||
} | ||
|
||
if (m_script->x <= 15) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a super odd way of using X. Use a different parameter. Do you really need a float?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i can make it x10 maybe in some data if need but will be even less intuitive
src/game/DBScripts/ScriptMgr.h
Outdated
@@ -445,6 +447,13 @@ struct ScriptInfo | |||
uint32 empty2; // datalong2 | |||
} logKill; | |||
|
|||
struct // SCRIPT_COMMAND_MOVE_DYNAMIC (37) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong comment im pretty sure
src/game/Globals/ObjectMgr.cpp
Outdated
fEntry->Options = fields[4].GetUInt32(); | ||
fEntry->Comment = fields[5].GetCppString(); | ||
|
||
auto gItr = newContainer->spawnGroupMap.find(fEntry->GroupId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just name it itr, its not like you have several iterators there.
@@ -1126,6 +1179,7 @@ void ObjectMgr::LoadSpawnGroups() | |||
SpawnGroupDbGuids guid; | |||
guid.Id = fields[0].GetUInt32(); | |||
guid.DbGuid = fields[1].GetUInt32(); | |||
guid.SlotId = fields[2].GetInt32(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we will have to talk about that
SPAWN_GROUP_FORMATION_TYPE_FANNED_OUT_IN_FRONT = 5, | ||
SPAWN_GROUP_FORMATION_TYPE_CIRCLE_THE_LEADER = 6, | ||
|
||
SPAWN_GROUP_FORMATION_TYPE_COUNT = 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 8th type missing here maybe? Even adding a placeholder would be cool even if its not implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is it?
@@ -74,8 +75,39 @@ enum MovementGeneratorType | |||
EXTERNAL_WAYPOINT_MOVE = 17, // Only used in UnitAI::MovementInform when a waypoint is reached. The pathId >= 0 is added as additonal value | |||
EXTERNAL_WAYPOINT_MOVE_START = 18, // Only used in UnitAI::MovementInform when a waypoint is started. The pathId >= 0 is added as additional value | |||
EXTERNAL_WAYPOINT_FINISHED_LAST = 19, // Only used in UnitAI::MovementInform when the waittime of the last wp is finished The pathId >= 0 is added as additional value | |||
|
|||
FORMATION_MOTION_TYPE = 20, // TargetedMovementGenerator.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will it work in creature table, in DB it will be still 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That have nothing to do with defaut movement type in db.
Its only for movement generator internally and used for follower i should rename it.
Fiw last reached point to previous point after calling WaypointMovementGenerator<Creature>::SetNextWaypoint(uint32 pointId)
Add script command add creature, remove creature, switch formation type Handle adding and removing player from/to formation (in case of possessning) Fix a couple of issues
Add a db script command to make it possible ``` datalong = command(2 for formation create) datalong2 = group id to send this command (0 mean remove the formation of current group) int[0] = type int[1] = options int[2] = MovementType int[3] = MovementID spread = x ```
also a bit more cleaning
Better to avoid problems with forgetted variables initialization and duplicate code
So normal update will be called
a bit more cleaning and soma error text fixes
Remove some of the custom code not needed anymore
So if master respawn very far from its followers they will get teleported or run to it. also fix formation shape reset after master respawn
We should take care of how we handle movement in core and generalize the fact that movement id should not be tied to an entry or a guid. So everything in creature_movement or creature_movement_template should be moved to new movement_template table.
Specify the change for command MOVE_TO that will now support move to respawn pos for the creature itself or its entire group.
Only formation code in it for now Ability to set formation shape, spread and options via script
58d70e8
to
5c321aa
Compare
🍰 Pullrequest
Proof
Issues
How2Test
Todo / Checklist