If a ship with role "police" is spawned by a script (or via the console) it does not get CLASS_POLICE, but CLASS_NEUTRAL, if no scan_class is specified in its shipdata. If it's spawned by the populator, the correct scan_class is assigned, even if there is no entry in shipdata. But script-added police currently need their scan_class explicitly set.
I think that's a bug.
script-spawned police doesn't get correct scan_class
Moderators: winston, another_commander, Getafix
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: script-spawned police doesn't get correct scan_class
As suggested elsewhere, could the auto_AI flag in shipdata.plist also be used to set the scanClass for appropriate roles? For example if auto_AI is true and the role is "police" or "wingman" (and possibly others too) then the scanClass gets auto-set to the appropriate values too.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
Re: script-spawned police doesn't get correct scan_class
Doesn't sound too undoable...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: script-spawned police doesn't get correct scan_class
Its an easy addition to the current code that sets bounty for some script added ships. Looking at the code, the populator does not force a CLASS_POLICE for police on route. Only when no scan_class was set it becomes police scan_class. That means when you define CLASS_MILITARY for a police, it will keep its military class. I don't think that is wanted behaviour as that will lead to adding not wingman but escorts and they will get a military scanclass from their mother. So it will be a military ship with civilian escort-ship that have a military label.Kaks wrote:Doesn't sound too undoable...
stations do it different again. Patrol is forced to CLASS_POLICE, while defence_ships keep their scan_class from shipData. When no class was defined, they keep a CLASS_NOT_SET.
All the code starts with
newShipWithRole:
, so adding the fix there will also force police on the other locations to CLASS_POLICE unless auto_ai is explicitly set to false. So I leave the code on the other locations as it is at that fix will so a lot of the potential other problems.----
I also took a look on thargoids. When added in interstellar space they always get a CLASS_THARGOID but in normal space only when no other scan_class was defined for them. Look a bit buggy when they are handled differently. But there is no auto_ai for thargoids because the populator never has altered their AI. I don't want to change that and risking breakage of existing thargoids.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: script-spawned police doesn't get correct scan_class
That is the approach I am following. But what looked like a simple 1 line change proofs to be more work. Not directly because of this bug, but checking against other code to make sure I don't introduce new bugs lets me stumble over all kind of other small bugs/inconsistencies.Thargoid wrote:As suggested elsewhere, could the auto_AI flag in shipdata.plist also be used to set the scanClass for appropriate roles? For example if auto_AI is true and the role is "police" or "wingman" (and possibly others too) then the scanClass gets auto-set to the appropriate values too.
wingman need no special handling. They are only selected when the mother has police scan_class and they inherit their mothers scan_class. But interceptors need also get a scan_class set. And they need a correct pilot. The populator adds police characters as pilot, but a script will add a random character to an interceptor. So they could have bounties than.
Populator added interceptors are added in game with a primary role of police. I will change trunk so the same happens for script added ones. That way they automatically receive the correct 'police' pilot. (= clean with 125 ₢. insurance).
I'll make script and populater consistent. With auto_ai = true (default) or without scan_class defined, the police (and interceptors) will always be forced into a police scanclass. With auto_ai = false the defined scan_class will be used. Probably never useful, but who knows what use for it some scripters might invent
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Re: script-spawned police doesn't get correct scan_class
/me looks causally at McLane & ThargoidEric Walch wrote:Probably never useful, but who knows what use for it some scripters might invent
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- CommonSenseOTB
- ---- E L I T E ----
- Posts: 1397
- Joined: Wed May 04, 2011 10:42 am
- Location: Saskatchewan, Canada
Re: script-spawned police doesn't get correct scan_class
Stolen Viper oxp perhaps?Kaks wrote:/me looks casually at McLane & ThargoidEric Walch wrote:Probably never useful, but who knows what use for it some scripters might invent
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.
CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
Re: script-spawned police doesn't get correct scan_class
/me whistles innocently...
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link