-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from steven11sjf/super-missile-expansion
added super missile expansion
- Loading branch information
Showing
4 changed files
with
91 additions
and
42 deletions.
There are no files selected for viewing
71 changes: 29 additions & 42 deletions
71
src/open_dread_rando/cosmetic_patches/missile_color_patcher.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,77 @@ | ||
import dataclasses | ||
|
||
from open_dread_rando.misc_patches.material_patcher import MaterialData, create_custom_material | ||
from open_dread_rando.misc_patches.model_patcher import ModelData, create_custom_model | ||
from open_dread_rando.misc_patches.material_patcher import MaterialData | ||
from open_dread_rando.misc_patches.model_patcher import StaticModelChanger | ||
from open_dread_rando.patcher_editor import PatcherEditor | ||
|
||
|
||
# model names for pride missiles | ||
@dataclasses.dataclass() | ||
class MissileVariant: | ||
mat_name: str | ||
model_path: str | ||
shader_path: str | ||
rgba: tuple[float, float, float, float] | ||
|
||
class MissileTankRecolor(StaticModelChanger): | ||
def __init__(self, name: str, color: tuple[float, float, float, float]): | ||
self.mat_name = f"{name}_mp_fxhologram_01" | ||
self.model_path = f"actors/items/item_missiletank/models/{name}.bcmdl" | ||
self.shader_path = f"actors/items/item_missiletank/models/imats/{self.mat_name}.bsmat" | ||
self.materials = { | ||
"mp_fxhologram_01": MaterialData( | ||
base_mat="actors/items/item_missiletank/models/imats/item_missiletank_mp_fxhologram_01.bsmat", | ||
new_mat_name=f"{name}_mp_fxhologram_01", | ||
new_path=f"actors/items/item_missiletank/models/imats/{name}_mp_fxhologram_01.bsmat", | ||
uniform_params={ | ||
"vTex0EmissiveColor": color | ||
} | ||
) | ||
} | ||
|
||
self.rgba = color | ||
self.base_model_path="actors/items/item_missiletank/models/item_missiletank.bcmdl" | ||
self.new_model_path=f"actors/items/item_missiletank/models/{name}.bcmdl" | ||
|
||
|
||
ALL_VARIANTS: dict[str, MissileVariant] = { | ||
"ORANGE": MissileVariant( | ||
MISSILE_TANK_RECOLORS: dict[str, MissileTankRecolor] = { | ||
"ORANGE": MissileTankRecolor( | ||
name="item_missile__OR", | ||
color=(75.0, 10.0, 0.0, 1.0), | ||
), | ||
"YELLOW": MissileVariant( | ||
"YELLOW": MissileTankRecolor( | ||
name="item_missile__YL", | ||
color=(30.0, 30.0, 0.0, 1.0), | ||
), | ||
"GREEN": MissileVariant( | ||
"GREEN": MissileTankRecolor( | ||
name="item_missile__GN", | ||
color=(0.0, 30.0, 0.0, 1.0), | ||
), | ||
"BLUE": MissileVariant( | ||
"BLUE": MissileTankRecolor( | ||
name="item_missile__BL", | ||
color=(0.05, 0.5, 75.0, 1.0), | ||
), | ||
"CYAN": MissileVariant( | ||
"CYAN": MissileTankRecolor( | ||
name="item_missile__CY", | ||
color=(0.05, 10.0, 10.0, 1.0), | ||
), | ||
"PURPLE": MissileVariant( | ||
"PURPLE": MissileTankRecolor( | ||
name="item_missile__PR", | ||
color=(15.0, 0.5, 70.0, 1.0), | ||
), | ||
"PINK": MissileVariant( | ||
"PINK": MissileTankRecolor( | ||
name="item_missile__PK", | ||
color=(70.0, 0.5, 7.0, 1.0), | ||
), | ||
"MAGENTA": MissileVariant( | ||
"MAGENTA": MissileTankRecolor( | ||
name="item_missile__MG", | ||
color=(70.0, 0.5, 70.0, 1.0), | ||
), | ||
"WHITE": MissileVariant( | ||
"WHITE": MissileTankRecolor( | ||
name="item_missile__WH", | ||
color=(30.0, 30.0, 30.0, 1.0), | ||
), | ||
"BLACK": MissileVariant( | ||
"BLACK": MissileTankRecolor( | ||
name="item_missile__BK", | ||
color=(0.0, 0.0, 0.0, 1.0), | ||
), | ||
"GRAY": MissileVariant( | ||
"GRAY": MissileTankRecolor( | ||
name="item_missile__GY", | ||
color=(0.2, 0.2, 0.2, 1.0), | ||
), | ||
} | ||
|
||
|
||
def generate_missile_colors(editor: PatcherEditor): | ||
for _, variant in ALL_VARIANTS.items(): | ||
mat_dat = MaterialData( | ||
base_mat="actors/items/item_missiletank/models/imats/item_missiletank_mp_fxhologram_01.bsmat", | ||
new_mat_name=variant.mat_name, | ||
new_path=variant.shader_path, | ||
uniform_params={ | ||
"vTex0EmissiveColor": variant.rgba | ||
} | ||
) | ||
|
||
model_dat = ModelData( | ||
base_model="actors/items/item_missiletank/models/item_missiletank.bcmdl", | ||
new_path=variant.model_path, | ||
materials={"mp_fxhologram_01": variant.shader_path} | ||
) | ||
|
||
create_custom_material(editor, mat_dat) | ||
create_custom_model(editor, model_dat) | ||
for _, recolor in MISSILE_TANK_RECOLORS.items(): | ||
recolor.generate(editor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters