Author Topic: Override Work in WorkItem children?  (Read 2977 times)

0 Members and 1 Guest are viewing this topic.

February 08, 2017, 04:39:55 PM
Read 2977 times

Aceria

  • *
  • Information
  • Member
  • Posts: 6
    • View Profile
I'm working on a mod that adds some more Marketing features, but I'm running into issues with overriding the default marketing behaviour.

I made a new class that extends MarketingPlan (because a part of the GUI depends on WorkItem being a known type), this class then needs to override behavior of the default MarketingPlan whenever I create my custom WorkItem.

Any chance of a (I guess) minor refactor to allow all required methods of WorkItems to be overwritten? It would also be possible if the game would allow custom WorkItem types, but that's likely more work.

Another option of doing what I want could be to manually add an update loop for the actors, but that seems like a ton of work for something relatively easy.

February 12, 2017, 10:57:44 PM
Reply #1

khornel

  • Dev
  • *****
  • Information
  • Member
  • Administrator
  • Posts: 369
    • View Profile
    • Software Inc
I added support for custom WorkItem types in the next update.

Work is now handled by overriding WorkItem.DoWork(Actor actor, float effectiveness, float delta)

February 13, 2017, 12:02:59 AM
Reply #2

Aceria

  • *
  • Information
  • Member
  • Posts: 6
    • View Profile
Quote
I added support for custom WorkItem types in the next update.

Awesome, is that the next patch or the next Alpha?

Quote
WorkItem.DoWork(Actor actor, float effectiveness, float delta)

There doesn't seem to be a DoWork to override in WorkItem, the only instances of DoWork I can find are in Actor and AutoDevWorkItem (or is this the change you're adding for the next update?)


I was also wondering what the hell the 4 panels at the bottom are called (the ones with the icons for Development/HR/Finance/Market), couldn't really figure that out from the HUD class.
« Last Edit: February 13, 2017, 12:08:05 AM by Aceria »

February 14, 2017, 12:24:49 AM
Reply #3

khornel

  • Dev
  • *****
  • Information
  • Member
  • Administrator
  • Posts: 369
    • View Profile
    • Software Inc

Awesome, is that the next patch or the next Alpha?
Next patch.
There doesn't seem to be a DoWork to override in WorkItem, the only instances of DoWork I can find are in Actor and AutoDevWorkItem (or is this the change you're adding for the next update?)
This is the change.

I was also wondering what the hell the 4 panels at the bottom are called (the ones with the icons for Development/HR/Finance/Market), couldn't really figure that out from the HUD class.
I've added a UI_UNDER_MOUSE console command to get the path to all UI elements currently under the mouse cursor and the function WindowManager.FindElementPath(string path, Transform startFrom = null, int index = 0) to retrieve them in code.

February 15, 2017, 04:57:11 PM
Reply #4

Aceria

  • *
  • Information
  • Member
  • Posts: 6
    • View Profile
Sounds good, looking forward to the next patch!

Do a rough timeline on when that patch will go live?

February 18, 2017, 04:19:35 PM
Reply #5

Aceria

  • *
  • Information
  • Member
  • Posts: 6
    • View Profile
Just got around to implementing a custom WorkItem, but it seems that the GUIWorkItem does not support this. Extending another WorkItem (MarketingPlan in my case) wouldn't work either because I can't override some of the methods.

Is this as intended (e.g. should I implement my own progress bar to push in the Workitem list) or something you forgot?