* Undo removing Teamcomponent upfront since it causes errors when trying to find a team on initial owned base

This commit is contained in:
Aldin Duraki 2020-05-20 00:31:31 +02:00
parent 1571a1e786
commit 4bb5b9ee48

View File

@ -111,7 +111,7 @@ class EntityManager {
if base.changeOwnership { if base.changeOwnership {
//FIX-ME: Find a way to update the Component without deleting it upfront //FIX-ME: Find a way to update the Component without deleting it upfront
//TODO: outsource component handling to a generic function //TODO: outsource component handling to a generic function
base.removeComponent(ofType: TeamComponent.self) //base.removeComponent(ofType: TeamComponent.self)
base.addComponent(TeamComponent( base.addComponent(TeamComponent(
team: (entities[0] as! Base).component(ofType: TeamComponent.self)!.team, team: (entities[0] as! Base).component(ofType: TeamComponent.self)!.team,
player: (entities[0] as! Base).component(ofType: TeamComponent.self)!.player, player: (entities[0] as! Base).component(ofType: TeamComponent.self)!.player,
@ -142,7 +142,7 @@ class EntityManager {
base.ownershipPlayer = getOwnerBySnapBase base.ownershipPlayer = getOwnerBySnapBase
//FIX-ME: Find a way to update the Component without deleting it upfront //FIX-ME: Find a way to update the Component without deleting it upfront
//TODO: outsource component handling to a generic function //TODO: outsource component handling to a generic function
entity.removeComponent(ofType: TeamComponent.self) //entity.removeComponent(ofType: TeamComponent.self)
entity.addComponent(TeamComponent( entity.addComponent(TeamComponent(
team: getTeamByPlayer(playerName: snapBase.ownership!), team: getTeamByPlayer(playerName: snapBase.ownership!),
player: getOwnerBySnapBase!, player: getOwnerBySnapBase!,