Can anyone think of a way to make a cash trickler depent on power?
I'm trying to make a PROC replacement with a cash trickler (like in the GreenFields maps of DraLUSAD), but it needs to stop 'trickling' if the base is low on power.
Just adding the 'RequiresPower' trait doesn't stop the trickler.
cash trickler dependent on power?
Re: cash trickler dependent on power?
As I could not find a way, I copied CashTrickler.cs -> PoweredCashTrickler.cs and added the following lines (inspired by / copied from ProvidesRadar.cs):twarpie wrote: ↑Can anyone think of a way to make a cash trickler depent on power?
Code: Select all
[..]
public void Tick(Actor self)
{
// Check if powered: no trickling if disabled
if (self.TraitsImplementing<IDisable>().Any(d => d.Disabled))
return;
[..]
PoweredCashTrickler could probably extend CashTrickler and override the Tick(..) method, but I was unsure how that would work with the CashTricklerInfo bits.
edit: in case someone is interested, added patch.
- Attachments
-
- openra_poweredcashtrickler.patch.txt
- (1.67 KiB) Downloaded 273 times
Second version of patch: removed extra class, added field to CashTricklerInfo: RequiresPower.
Add a line to CashTrickler traits in map.yaml:
Cleaner approach?
Add a line to CashTrickler traits in map.yaml:
Code: Select all
[..]
CashTrickler:
RequiresPower: True
[..]
- Attachments
-
- openra_cashtrickler_requirespower.patch.txt
- (934 Bytes) Downloaded 264 times