Reorganize weapons #5

Merged
ranguli merged 8 commits from reorganize-weapons into main 2022-01-31 15:02:56 -08:00
ranguli commented 2022-01-30 18:00:52 -08:00 (Migrated from github.com)

This PR does a lot of refactoring, as well as:

  • Create a ranged_weapons table that acts as a global data structure for constants.
  • Create a gun_data table to use for describing common values, that will eventually be used for every weapon entity in the mod.
This PR does a lot of refactoring, as well as: - Create a `ranged_weapons` table that acts as a global data structure for constants. - Create a `gun_data` table to use for describing common values, that will eventually be used for every weapon entity in the mod.
Beanzilla commented 2022-01-30 18:22:39 -08:00 (Migrated from github.com)

When ever you get the re-organizing done let me know then I will accept this PR.

When ever you get the re-organizing done let me know then I will accept this PR.
Beanzilla (Migrated from github.com) reviewed 2022-01-30 19:15:44 -08:00
Beanzilla (Migrated from github.com) commented 2022-01-30 19:15:44 -08:00

Or make a global namespace like rangedweapons = {} then add this to that...

-- In Init.lua
rangedweapons = {}

-- In this file
rangedweapons.colors = {}
local colors = rangedwepons.colors
colors.white = "#FFFFFF"

-- In any file that uses colors
ranged.weapons.colors.white
Or make a global namespace like `rangedweapons = {}` then add this to that... ```lua -- In Init.lua rangedweapons = {} -- In this file rangedweapons.colors = {} local colors = rangedwepons.colors colors.white = "#FFFFFF" -- In any file that uses colors ranged.weapons.colors.white ```
Beanzilla (Migrated from github.com) reviewed 2022-01-30 19:16:16 -08:00
Beanzilla (Migrated from github.com) commented 2022-01-30 19:16:16 -08:00

Again, could be added to a global "namespace"

Again, could be added to a global "namespace"
Beanzilla (Migrated from github.com) reviewed 2022-01-30 19:18:22 -08:00
Beanzilla (Migrated from github.com) commented 2022-01-30 19:18:22 -08:00

Looks like good place for:

  1. Convert these to a table (e.g. settings)
  2. Change from string to bool
Looks like good place for: 1. Convert these to a table (e.g. settings) 2. Change from string to bool
Beanzilla (Migrated from github.com) reviewed 2022-01-30 19:21:41 -08:00
@ -0,0 +1,5 @@
if minetest.global_exists("armor") and armor.attributes then
Beanzilla (Migrated from github.com) commented 2022-01-30 19:21:41 -08:00
if minetest.global_exists("armor") and armor.attributes then
    table.insert(armor.attributes, "bullet_res")
    table.insert(armor.attributes, "ammo_save")
    table.insert(armor.attributes, "ranged_dmg")
end
-- Why do we need 3 checks just to add 3 values? (Sorry this may be the original code base leaking it's ugly head out)
```lua if minetest.global_exists("armor") and armor.attributes then table.insert(armor.attributes, "bullet_res") table.insert(armor.attributes, "ammo_save") table.insert(armor.attributes, "ranged_dmg") end -- Why do we need 3 checks just to add 3 values? (Sorry this may be the original code base leaking it's ugly head out) ```
Beanzilla commented 2022-01-30 19:25:29 -08:00 (Migrated from github.com)

I can hardly wait to start working on improving this code base... now that my issue where I fire a gun and it crashes. (I originally was going to abandon this project... now I might be reviewing this stuff and getting it to a better state)

I feel energy weapons eat the Power Particles at insane rates, compared to physical guns that require the ammo/shells. (Might either buff the generator or just buff the guns so they consume less per shot)

I can hardly wait to start working on improving this code base... now that my issue where I fire a gun and it crashes. (I originally was going to abandon this project... now I might be reviewing this stuff and getting it to a better state) > I feel energy weapons eat the Power Particles at insane rates, compared to physical guns that require the ammo/shells. (Might either buff the generator or just buff the guns so they consume less per shot)
Beanzilla commented 2022-01-31 13:33:17 -08:00 (Migrated from github.com)

I'm going to work on rewriting all the settings so it's in a global and so it uses minetest.conf (where it should be getting set, rather than hardcoded in some lua file, My own mods are guilty of this too, but now I understand minetest.settings a bit better)

> I'm going to work on rewriting all the settings so it's in a global and so it uses `minetest.conf` (where it should be getting set, rather than hardcoded in some lua file, My own mods are guilty of this too, but now I understand minetest.settings a bit better)
ranguli (Migrated from github.com) reviewed 2022-01-31 13:54:26 -08:00
ranguli (Migrated from github.com) commented 2022-01-31 13:54:26 -08:00

Done!

Done!
ranguli (Migrated from github.com) reviewed 2022-01-31 13:56:37 -08:00
@ -0,0 +1,5 @@
if minetest.global_exists("armor") and armor.attributes then
ranguli (Migrated from github.com) commented 2022-01-31 13:56:36 -08:00

This is indeed the original code being smelly. Fixed 👍

This is indeed the original code being smelly. Fixed :+1:
Beanzilla commented 2022-01-31 14:11:09 -08:00 (Migrated from github.com)

Have you figured out what other_weapons_crafting goes too? (I'd like to make it a better name than other_weapons, but need to know what weapons does it affect?)

Have you figured out what other_weapons_crafting goes too? (I'd like to make it a better name than other_weapons, but need to know what weapons does it affect?)
ranguli commented 2022-01-31 14:13:12 -08:00 (Migrated from github.com)

It gets used here in crafting.lua, and that seems to be it.

It gets used [here](https://github.com/Beanzilla/rangedweapons-1/blob/41f871d6e0503a3da9d50e6d61a887d55bc115f1/crafting.lua#L394) in crafting.lua, and that seems to be it.
Beanzilla commented 2022-01-31 14:23:03 -08:00 (Migrated from github.com)

Looks like a few throwing weapons, then gun parts...

I'm leaning on renaming that to craft_gun_parts (or gun_parts_crafting), Just need to make sure those throwing weapons get moved into throwing weapon category.

I've got some of the settings moved into the settings-conf branch. (This will eventually need to get PRed into master, but after this commit, I see lot's changing and that means I need to wait for you to make this an official PR so I can merge it into master than merge the settings-conf branch)

Looks like a few throwing weapons, then gun parts... > I'm leaning on renaming that to craft_gun_parts (or gun_parts_crafting), Just need to make sure those throwing weapons get moved into throwing weapon category. I've got some of the settings moved into the `settings-conf` branch. (This will eventually need to get PRed into master, but after this commit, I see lot's changing and that means I need to wait for you to make this an official PR so I can merge it into master than merge the `settings-conf` branch)
ranguli commented 2022-01-31 14:42:28 -08:00 (Migrated from github.com)

I'll wrap up these changes in the next commit or two and mark as ready for review. Once both PRs are merged I'll keep going with new fixes in a new PR.

I'll wrap up these changes in the next commit or two and mark as ready for review. Once both PRs are merged I'll keep going with new fixes in a new PR.
Beanzilla commented 2022-01-31 14:44:11 -08:00 (Migrated from github.com)

Sounds good with me. :)

Thank you for your work so far, and looking forward to working more on this project. 🥇

Sounds good with me. :) > Thank you for your work so far, and looking forward to working more on this project. :1st_place_medal:
ranguli commented 2022-01-31 14:57:28 -08:00 (Migrated from github.com)

I'm looking forward as well! As it stands this PR does still leave a ton of things broken, but its a step in the right direction.

I'm looking forward as well! As it stands this PR does still leave a ton of things broken, but its a step in the right direction.
Beanzilla commented 2022-01-31 15:02:48 -08:00 (Migrated from github.com)

Merging...

Merging...
Beanzilla commented 2022-01-31 15:07:10 -08:00 (Migrated from github.com)

Ok ready for more PRs.

Ok ready for more PRs.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: minenux/minetest-mod-nssw#5
There is no content yet.