Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor blazemod [RDY] #17456

Merged
merged 22 commits into from Sep 10, 2016

Conversation

Projects
None yet
6 participants
@mugling
Copy link
Contributor

commented Jul 1, 2016

Cleanup of #17417 using #17431

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Jul 12, 2016

Done. No assessment as to balance just refactoring of the JSON using the lint tool

@codemime

This comment has been minimized.

Copy link
Member

commented Jul 12, 2016

The PR is damn huge.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Jul 12, 2016

The PR is damn huge.

Yes, no way around that - reformatting only adds ~30% versus the parent PR (#17417)

@mugling mugling changed the title Refactor blazemod [WIP] Refactor blazemod [RDY] Jul 16, 2016

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2016

Is it tested or only reformatted?

"ammo_type": "hbolt",
"damage": 14,
"effects": [ "FLAME", "NEVER_MISFIRES", "COOKOFF" ],
"flags": [ "" ]

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jul 18, 2016

Contributor

This line is horrible. Can linter detect and remove those too?

This comment has been minimized.

Copy link
@mugling

mugling Jul 18, 2016

Author Contributor

This line is horrible. Can linter detect and remove those too?

I could extend it to provide a NOEMPTY output flag

"symbol": "*",
"color": "red",
"count": 1,
"stack_size": 1,

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jul 18, 2016

Contributor

Aren't "count": 1 and "stack_size": 1 redundant?

This comment has been minimized.

Copy link
@mugling

mugling Jul 18, 2016

Author Contributor

Yes, but that is out of scope of the linter - it's valid JSON, a valid field and sensibly formatted.

Strict mode (#17722 etc) could detect this but cannot be enabled by default for mods due to the false positives that would be reported due to the variation in load order. One option would be a command-line switch that selectively tested a mod in strict mode and output a non-compliance log?

"damage": 14,
"effects": [ "NAPALM", "NEVER_MISFIRES", "COOKOFF" ],
"flags": [ "" ]
},

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jul 18, 2016

Contributor

This entire line of items is a giant block of horrible copy+paste. Would benefit from some "similar json detector" system that would replace sets of definitions with copy-from entry.
Extending linter to do that would probably be too much work (it's too specialized), but I could write a custom script just to do that for this PR.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Jul 18, 2016

Is it tested or only reformatted?

It is only reformatted. I haven't addressed balance or anything like that.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2016

I haven't addressed balance or anything like that.

Balance can be off (most likely is), but someone will have to bite the bullet and go through all of this crap to check if it actually works or spews debugmsgs on every attempt.

Or we can just say "fuck it" and merge it with the assumption that mod content can be full retard. But then we'll have to maintain it.

Yes, but that is out of scope of the linter - it's valid JSON, a valid field and sensibly formatted.

Could you run a separate script for that? Some simple jq equivalent of:

if( entry["type"] == "ammo" && entry["count"] == 1 ) entry.erase( "count" );

and ditto for "stack_size".

The PR is unreviewably huge and ugly. Some quick and dirty solutions may be necessary to trim it to manageable size.

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Jul 18, 2016

Yes, some jq-fu could be in order

Or we can just say "fuck it" and merge it with the assumption that mod content can be full retard.

It's better by far than the status quo and to be honest I can only justify further effort in this PR in that context.

But then we'll have to maintain it.

This is effectively a one-time deal. We should do everything possible to avoid getting to this situation again. Maintenance should be more practical given the lack of JSON errors and the author becomes responsible for any fixes internal to the mod.

Summarily if I run this through jq and possibly sed and get no load errors are you agreeable to a merge?

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2016

Summarily if I run this through jq and possibly sed and get no load errors are you agreeable to a merge?

I'd still have objections. This needs automated testing.
I can write a unit test specifically for it.
Since we're essentially re-mainlining a mod, it should at the very least work. Doesn't need to work well, but should work.

I see a unit test like this:

  • Load blazemod
  • For every single turret in the mod:
  • Spawn single-frame vehicle
  • Install full storage battery and the turret on the vehicle
  • Find a holder for the default ammo of this turret
  • If it exists, install a holder and fill it to the brim with default ammo
  • If it doesn't, try to fill the turret instead
  • Fire the turret at random tile within its range
  • Wait a turn
  • If no debugmsgs happen, continue, otherwise print that this turret is wonky and mark the test as failure

I assume many turrets will fail it, so whatever commands you're using to clean this up you should save in a script. We'll have to work with blaze to make the mod at least work before it's really mergeable, so we'll most likely have to clean it up more than once.

@mugling mugling referenced this pull request Jul 19, 2016

Merged

Vehicle turret reloading #17751

2 of 2 tasks complete
@BorkBorkGoesTheCode

This comment has been minimized.

Copy link
Contributor

commented Jul 28, 2016

Do you need help?

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Aug 9, 2016

When is this coming?

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 9, 2016

Waiting on #17746

@BorkBorkGoesTheCode

This comment has been minimized.

Copy link
Contributor

commented Aug 24, 2016

Are you still interested in merging this?

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Aug 31, 2016

Needs a rebase then some fixes to pass the unit tests but we should be otherwise ready. @Coolthulhu anything else?

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Sep 1, 2016

Once it passes the firing test and is mergeable, it should be better than the broken version we have in master.

@mugling mugling force-pushed the mugling:blazemod branch 3 times, most recently to c75dbfd Sep 9, 2016

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 9, 2016

This is very difficult to rebase

@mugling mugling force-pushed the mugling:blazemod branch Sep 10, 2016

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2016

0227c16 fixes a bug whereby specifying terrain:symbol or terrain:color as an array with one element results in a cryptic error message. The new version supports loading a string, an array with a single element or an array of four elements. Anything else yields a descriptive error message.

Almost ready:

  • ./cataclysm-tiles --check-mods blazemod
  • gmake json-lint
  • ./tests/cata_test --mods=blazemod [gun]

@mugling mugling force-pushed the mugling:blazemod branch to 8236216 Sep 10, 2016

@mugling

This comment has been minimized.

Copy link
Contributor Author

commented Sep 10, 2016

Passes all automated tests and considerably easier to work on than before. No doubt the mod contains other issues but I'm going to merge this as per the above discussion.

@mugling mugling merged commit 368db5e into CleverRaven:master Sep 10, 2016

This was referenced Sep 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.