Feature CCS scripts created in subdirectories are not found on restart

Boogaloogaloo

New member
The reason this happens is because creating a new ccs file called "farming/castle" will create a file under the path "ccs/farming/castle.ccs". In my opinion, this is a good thing as it allows me to arrange my ccs directory logically.

The problem is that CustomCombatManager.getAvailableScripts() only reads files in the base ccs directory.

This is the current situation on Linux. It may be the same on Windows because running mkdir "foo/bar" creates a directory bar nested in the new directory foo. However, I can't be sure as I don't really have the tooling to test at the moment.

I've attached a preliminary patch (probably needs work) that will handle files located in directories, and prepend the directory name followed by a forward slash to the ccs script name. The big question is whether this works on Windows because of the differences in pathname handling.
 

Attachments

  • ccs-directories.diff
    1.6 KB · Views: 32

Winterbay

Active member
You could also name your CCS with an underscore instead of a slash.

Just for completeness I tested this on my windows machine and it created the /ccs/farming/castle directory here as well, but a restart of mafia (complete shut down and restart) did not reproduce the bahaviour of not finding the CCS. It is still very much in the list of CCS', running 8532.
 

Boogaloogaloo

New member
Just for completeness I tested this on my windows machine and it created the /ccs/farming/castle directory here as well, but a restart of mafia (complete shut down and restart) did not reproduce the bahaviour of not finding the CCS. It is still very much in the list of CCS', running 8532.

To clarify, it finds all CCS files but those in subdirectories. This has happened for a long time and still occurs with 8538. Having looked at the source, I can't even imagine how the behaviour you describe could possibly occur, because it uses DataUtilities.list which uses File.list to find the list of files. This method most certainly does not recurse subdirectories.

Edit: Oh, it does "remember" the last one you had selected, though. If you shut it down with a different CCS script selected, I guarantee it won't find it.
 
Last edited:

fronobulax

Developer
Staff member
You might wish to look at this thread. In the case of data files, the decision to not allow sub-directories was deliberate and the pleas for otherwise have so far been unheeded.
 

Boogaloogaloo

New member
I don't quite understand the data directory but it seems to be a different issue. You can create data files from a script. As far as I can tell, you can't actually create ccs files from a script.

Bale said:
map_to_file() & file_to_map() can access sub-directories, just not explicitly. If there are such files in sub-directories then mafia will detect and use them.

This is the issue I'm raising. At the moment ccs files are not detected in sub-directories.
 

Veracity

Developer
Staff member
So, to clarify, this is a Feature Request that we add code to look in subdirectories for CCS files. It most certainly is not a Bug.
I'll retag it.
 

Winterbay

Active member
I think it's reasonable that it does look in subdirectories since it apparently creates them. Even though I had no problem getting mine to actually find the one I had...
 
Top