mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-23 07:58:09 +00:00
Fix for broken crouch size in marathon/boo races. (#632)
Previously, if you entered a boo race your hitbox scale changes would never be applied, meaning your crouch size would be unchanged from your standing stance. This fixes that, and adds a single parameter to apply character physics.
This commit is contained in:
@@ -216,7 +216,9 @@ func _ready() -> void:
|
|||||||
character = CHARACTERS[int(Global.player_characters[player_id])]
|
character = CHARACTERS[int(Global.player_characters[player_id])]
|
||||||
Global.can_time_tick = true
|
Global.can_time_tick = true
|
||||||
if [Global.GameMode.BOO_RACE, Global.GameMode.MARATHON, Global.GameMode.MARATHON_PRACTICE].has(Global.current_game_mode) == false:
|
if [Global.GameMode.BOO_RACE, Global.GameMode.MARATHON, Global.GameMode.MARATHON_PRACTICE].has(Global.current_game_mode) == false:
|
||||||
apply_character_physics()
|
apply_character_physics(true)
|
||||||
|
else:
|
||||||
|
apply_character_physics(false)
|
||||||
apply_character_sfx_map()
|
apply_character_sfx_map()
|
||||||
Global.level_theme_changed.connect(apply_character_sfx_map)
|
Global.level_theme_changed.connect(apply_character_sfx_map)
|
||||||
Global.level_theme_changed.connect(apply_character_physics)
|
Global.level_theme_changed.connect(apply_character_physics)
|
||||||
@@ -232,22 +234,24 @@ func _ready() -> void:
|
|||||||
if Global.level_editor == null:
|
if Global.level_editor == null:
|
||||||
recenter_camera()
|
recenter_camera()
|
||||||
|
|
||||||
func apply_character_physics() -> void:
|
func apply_character_physics(apply: bool) -> void:
|
||||||
var path = "res://Assets/Sprites/Players/" + character + "/CharacterInfo.json"
|
var path = "res://Assets/Sprites/Players/" + character + "/CharacterInfo.json"
|
||||||
if int(Global.player_characters[player_id]) > 3:
|
if int(Global.player_characters[player_id]) > 3:
|
||||||
path = path.replace("res://Assets/Sprites/Players", Global.config_path.path_join("custom_characters/"))
|
path = path.replace("res://Assets/Sprites/Players", Global.config_path.path_join("custom_characters/"))
|
||||||
path = ResourceSetter.get_pure_resource_path(path)
|
path = ResourceSetter.get_pure_resource_path(path)
|
||||||
var json = JSON.parse_string(FileAccess.open(path, FileAccess.READ).get_as_text())
|
var json = JSON.parse_string(FileAccess.open(path, FileAccess.READ).get_as_text())
|
||||||
|
|
||||||
|
if apply:
|
||||||
for i in json.physics:
|
for i in json.physics:
|
||||||
set(i, json.physics[i])
|
set(i, json.physics[i])
|
||||||
|
|
||||||
for i in get_tree().get_nodes_in_group("SmallCollisions"):
|
for i in get_tree().get_nodes_in_group("SmallCollisions"):
|
||||||
var hitbox_scale = json.get("small_hitbox_scale", [1, 1])
|
var hitbox_scale = json.get("small_hitbox_scale", [1, 1]) if apply else [1, 1]
|
||||||
i.hitbox = Vector3(hitbox_scale[0], hitbox_scale[1] if i.get_meta("scalable", true) else 1, json.get("small_crouch_scale", 0.75))
|
i.hitbox = Vector3(hitbox_scale[0], hitbox_scale[1] if i.get_meta("scalable", true) else 1, json.get("small_crouch_scale", 0.75) if apply else 0.5)
|
||||||
i._physics_process(0)
|
i._physics_process(0)
|
||||||
for i in get_tree().get_nodes_in_group("BigCollisions"):
|
for i in get_tree().get_nodes_in_group("BigCollisions"):
|
||||||
var hitbox_scale = json.get("big_hitbox_scale", [1, 1])
|
var hitbox_scale = json.get("big_hitbox_scale", [1, 1]) if apply else [1, 1]
|
||||||
i.hitbox = Vector3(hitbox_scale[0], hitbox_scale[1] if i.get_meta("scalable", true) else 1, json.get("big_crouch_scale", 0.5))
|
i.hitbox = Vector3(hitbox_scale[0], hitbox_scale[1] if i.get_meta("scalable", true) else 1, json.get("big_crouch_scale", 0.5) if apply else 0.5)
|
||||||
i._physics_process(0)
|
i._physics_process(0)
|
||||||
|
|
||||||
func apply_classic_physics() -> void:
|
func apply_classic_physics() -> void:
|
||||||
|
Reference in New Issue
Block a user