diff options
35 files changed, 356 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..24d1f8f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# Properly detect languages on Github +*.h linguist-language=cpp +*.inc linguist-language=cpp +thirdparty/* linguist-vendored + +# The above only works properly for Git 2.10+, so for older versions +# we need to manually list the binary files we don't want modified. +*.icns filter=lfs diff=lfs merge=lfs -text +*.ico binary +*.jar filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.tza filter=lfs diff=lfs merge=lfs -text +*.material filter=lfs diff=lfs merge=lfs -text +*.import filter=lfs diff=lfs merge=lfs -text +*.mp3 filter=lfs diff=lfs merge=lfs -text diff --git a/godot/assets/game_objects/_defaultMat(Clone).material b/godot/assets/game_objects/_defaultMat(Clone).material new file mode 100644 index 0000000..d253967 --- /dev/null +++ b/godot/assets/game_objects/_defaultMat(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00036435fc78cd6fac0baf4d28e478bb65634d2517b4848b68307b20da53ddbc +size 1646 diff --git a/godot/assets/game_objects/asphalt(Clone).material b/godot/assets/game_objects/asphalt(Clone).material new file mode 100644 index 0000000..8ac1ddb --- /dev/null +++ b/godot/assets/game_objects/asphalt(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ea8dc42a26b53f831c9dfbb9fdd968213792757da7baf3ecf3b8b3bf500d4cc +size 1638 diff --git a/godot/assets/game_objects/asphaltEdge(Clone).material b/godot/assets/game_objects/asphaltEdge(Clone).material new file mode 100644 index 0000000..2efb60a --- /dev/null +++ b/godot/assets/game_objects/asphaltEdge(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6906449431c0d15775bc7a1ff677a40537364420d2b0b4f64015e6845b143c03 +size 1646 diff --git a/godot/assets/game_objects/border(Clone).material b/godot/assets/game_objects/border(Clone).material new file mode 100644 index 0000000..271d791 --- /dev/null +++ b/godot/assets/game_objects/border(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfe9a6b15efbf9df59849481dadbc9edc0f8a70c5a14c61fccdb4abdb6de0815 +size 1636 diff --git a/godot/assets/game_objects/bricks(Clone).material b/godot/assets/game_objects/bricks(Clone).material new file mode 100644 index 0000000..6ff5b65 --- /dev/null +++ b/godot/assets/game_objects/bricks(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24e9ef6fd610e8f987c3fd34748760abdf6d0dc3911d8e34176cbc229989aa7a +size 1636 diff --git a/godot/assets/game_objects/colorPurple(Clone).material b/godot/assets/game_objects/colorPurple(Clone).material new file mode 100644 index 0000000..c1db7de --- /dev/null +++ b/godot/assets/game_objects/colorPurple(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce52869e92ee7087a01b50468c4db2ca76a59715db600971f6fedb6f8e2e93c6 +size 1646 diff --git a/godot/assets/game_objects/colorRed(Clone).material b/godot/assets/game_objects/colorRed(Clone).material new file mode 100644 index 0000000..d3ff869 --- /dev/null +++ b/godot/assets/game_objects/colorRed(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:863bb9779ebd68fe6b248fce4fd23653c3eb59d40ad4632c9b826bb73aac7fe0 +size 1640 diff --git a/godot/assets/game_objects/colorWhite(Clone).material b/godot/assets/game_objects/colorWhite(Clone).material new file mode 100644 index 0000000..7350a67 --- /dev/null +++ b/godot/assets/game_objects/colorWhite(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a18a93f14177d964e45604feba3a0c9f79c49104a4426b1a45764c92144fb352 +size 1620 diff --git a/godot/assets/game_objects/colorYellow(Clone).material b/godot/assets/game_objects/colorYellow(Clone).material new file mode 100644 index 0000000..b3669da --- /dev/null +++ b/godot/assets/game_objects/colorYellow(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb1ec771f7706ea12e60833c091d119d34598694b9ed1920e0558d03d9771101 +size 1646 diff --git a/godot/assets/game_objects/cone(Clone).material b/godot/assets/game_objects/cone(Clone).material new file mode 100644 index 0000000..eddedd6 --- /dev/null +++ b/godot/assets/game_objects/cone(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe3610151b2c123ab879e88fbf0a6f0e54e79112c236e5820ce93046d29e9d5b +size 1632 diff --git a/godot/assets/game_objects/diceGolf_track1.glb b/godot/assets/game_objects/diceGolf_track1.glb Binary files differnew file mode 100644 index 0000000..2ff9ec4 --- /dev/null +++ b/godot/assets/game_objects/diceGolf_track1.glb diff --git a/godot/assets/game_objects/diceGolf_track1.glb.import b/godot/assets/game_objects/diceGolf_track1.glb.import new file mode 100644 index 0000000..a97f515 --- /dev/null +++ b/godot/assets/game_objects/diceGolf_track1.glb.import @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99304bfd3485d91b6f95434bc6dc743b2cc7a8784a70703fe2e05ab6f175eee8 +size 31873 diff --git a/godot/assets/game_objects/door(Clone).material b/godot/assets/game_objects/door(Clone).material new file mode 100644 index 0000000..e69e399 --- /dev/null +++ b/godot/assets/game_objects/door(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:307928d72c127bb47383243e8dded640898c94f6f34263e97c6e8e0f14a1210e +size 1632 diff --git a/godot/assets/game_objects/glass(Clone).material b/godot/assets/game_objects/glass(Clone).material new file mode 100644 index 0000000..a073012 --- /dev/null +++ b/godot/assets/game_objects/glass(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30b98a8b9ef35276ae29c90141933a0f7a027de61444131af82257d75caa8bf9 +size 1622 diff --git a/godot/assets/game_objects/grass(Clone).material b/godot/assets/game_objects/grass(Clone).material new file mode 100644 index 0000000..d967936 --- /dev/null +++ b/godot/assets/game_objects/grass(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b2e10c837bc4e20d18b58b85581328991698fffd4d9a51018b8031a3b7528f2 +size 1634 diff --git a/godot/assets/game_objects/leafsDark(Clone).material b/godot/assets/game_objects/leafsDark(Clone).material new file mode 100644 index 0000000..3c1a95b --- /dev/null +++ b/godot/assets/game_objects/leafsDark(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf260e0d7d3d086d1168bfd23f1d348fd44af8d297e2cdaedc621dce289fd88f +size 1642 diff --git a/godot/assets/game_objects/line(Clone).material b/godot/assets/game_objects/line(Clone).material new file mode 100644 index 0000000..21cfd02 --- /dev/null +++ b/godot/assets/game_objects/line(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ee1c0c9ca0cd37a58aa043446bbebf218585baaa194b2529f35af56f8855a85 +size 1632 diff --git a/godot/assets/game_objects/metalOrange(Clone).material b/godot/assets/game_objects/metalOrange(Clone).material new file mode 100644 index 0000000..88cf887 --- /dev/null +++ b/godot/assets/game_objects/metalOrange(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:586d353f7d779cc72a42cb2d927d3c1196e383149916c843f86b7b1b098bd3bb +size 1658 diff --git a/godot/assets/game_objects/pavement(Clone).material b/godot/assets/game_objects/pavement(Clone).material new file mode 100644 index 0000000..f5c3af9 --- /dev/null +++ b/godot/assets/game_objects/pavement(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd9e62a6da4c351a906b2430abfad0522bb88f9eea7296afa832621d8f960eb7 +size 1640 diff --git a/godot/assets/game_objects/roof(Clone).material b/godot/assets/game_objects/roof(Clone).material new file mode 100644 index 0000000..08b1bda --- /dev/null +++ b/godot/assets/game_objects/roof(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc429afbea6374ed189d807a3269a7431e906b17680b9e90e6041382212f47c4 +size 1632 diff --git a/godot/assets/game_objects/steel(Clone).material b/godot/assets/game_objects/steel(Clone).material new file mode 100644 index 0000000..c5b3e6c --- /dev/null +++ b/godot/assets/game_objects/steel(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a9662c48cb176e622e742f19245f8f823e3fee334a4b8a8aaf1f08d35e829c6 +size 1646 diff --git a/godot/assets/game_objects/stone(Clone).material b/godot/assets/game_objects/stone(Clone).material new file mode 100644 index 0000000..d3491ac --- /dev/null +++ b/godot/assets/game_objects/stone(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3315e564b72e2de9bf36f21cd409a72bd23dc87811c4cc98701cdf4a926d680 +size 1634 diff --git a/godot/assets/game_objects/stoneDark(Clone).material b/godot/assets/game_objects/stoneDark(Clone).material new file mode 100644 index 0000000..f6f1fec --- /dev/null +++ b/godot/assets/game_objects/stoneDark(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:019b2380e62062c604af001ba75425f9cfa49ba175ca4e8947ea10a75ef2c114 +size 1642 diff --git a/godot/assets/game_objects/stoneLight(Clone).material b/godot/assets/game_objects/stoneLight(Clone).material new file mode 100644 index 0000000..4c731b7 --- /dev/null +++ b/godot/assets/game_objects/stoneLight(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d14de87a41e990aaf89895794c82dde59b497110df926b97ab5d6ed952489ccd +size 1644 diff --git a/godot/assets/game_objects/trim(Clone).material b/godot/assets/game_objects/trim(Clone).material new file mode 100644 index 0000000..c60b5c8 --- /dev/null +++ b/godot/assets/game_objects/trim(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:997d55bd216ec93082195958b23a23c2ed910ae8c2527d3f36e3c98861208a93 +size 1632 diff --git a/godot/assets/game_objects/window(Clone).material b/godot/assets/game_objects/window(Clone).material new file mode 100644 index 0000000..62c30d7 --- /dev/null +++ b/godot/assets/game_objects/window(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da99523080d38233e996dbd3c83008c68893836435c911413da5a2e2036dd680 +size 1636 diff --git a/godot/assets/game_objects/woodBarkDark(Clone).material b/godot/assets/game_objects/woodBarkDark(Clone).material new file mode 100644 index 0000000..531dc26 --- /dev/null +++ b/godot/assets/game_objects/woodBarkDark(Clone).material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d2eca5c43e18280804d75b3223570dd1cb5f6b44e5674c2660da133c58b22fa +size 1648 diff --git a/godot/assets/sounds/Uuhhh.mp3 b/godot/assets/sounds/Uuhhh.mp3 Binary files differindex ea917a2..9586316 100644 --- a/godot/assets/sounds/Uuhhh.mp3 +++ b/godot/assets/sounds/Uuhhh.mp3 diff --git a/rust/src/buff_ball.rs b/rust/src/buff_ball.rs new file mode 100644 index 0000000..4b89dbb --- /dev/null +++ b/rust/src/buff_ball.rs @@ -0,0 +1,79 @@ +use gdnative::api::*; +use gdnative::prelude::*; +use crate::buff_trait::Buff; + +struct BuffBall { + name: String, + description: String, + + die_body: Option<Ref<RigidBody>>, + sphere_body: Option<Ref<RigidBody>> +} + +impl BuffBall { + fn new(die_body: Option<Ref<RigidBody>>, sphere_body: Option<Ref<RigidBody>>) -> Self { + BuffBall { + name: String::from("Ball"), + description: String::from("Roll the dice"), + + die_body, + sphere_body + } + } +} + +impl Buff for BuffBall { + unsafe fn execute_buff(&mut self) { + // make sure the sphere rigid body exists + match &self.sphere_body { + Some(sphere) => { + // make sure the dice rigid body exists + match &self.die_body { + Some(die) => { + // get the safe references from the ref<> + let save_sphere = sphere.assume_safe(); + let save_die = die.assume_safe(); + + // set the properties of the rigid bodies + save_die.set_process(false); + save_sphere.set_process(true); + save_sphere.show(); + }, + None => godot_warn!("Die body not assigned") + } + }, + None => godot_warn!("Sphere body not assigned") + } + } + + unsafe fn revert_buff(&mut self) { + // make sure the sphere rigid body exists + match &self.sphere_body { + Some(sphere) => { + // make sure the dice rigid body exists + match &self.die_body { + Some(die) => { + // get the safe references from the ref<> + let save_sphere = sphere.assume_safe(); + let save_die = die.assume_safe(); + + // set the properties of the rigid bodies + save_die.set_process(true); + save_sphere.set_process(false); + save_sphere.hide(); + }, + None => godot_warn!("Die body not assigned") + } + }, + None => godot_warn!("Sphere body not assigned") + } + } + + fn get_name(self) -> GodotString { + GodotString::from_str(self.name) + } + + fn get_description(self) -> GodotString { + GodotString::from_str(self.description) + } +} diff --git a/rust/src/buff_bounce.rs b/rust/src/buff_bounce.rs new file mode 100644 index 0000000..179642d --- /dev/null +++ b/rust/src/buff_bounce.rs @@ -0,0 +1,74 @@ +use gdnative::api::*; +use gdnative::prelude::*; +use crate::buff_trait::Buff; + +struct BuffBounce { + name: String, + description: String, + rigid_body: Option<Ref<RigidBody>>, + + target_bounciness: f64, + previous_bounciness: f64 +} + +impl BuffBounce { + fn new(rigid_body: Option<Ref<RigidBody>>) -> Self { + BuffBounce { + name: String::from("Bounce"), + description: String::from("Let's the die bounce more than usual."), + rigid_body, + + target_bounciness: 1.0, + previous_bounciness: 0.0 + } + } +} + +impl Buff for BuffBounce { + unsafe fn execute_buff(&mut self) { + // make sure the rigid body exists + match &self.rigid_body { + Some(body) => { + let safe_body = body.assume_safe(); + + // get the physics material + match safe_body.physics_material_override() { + Some(mat) => { + let save_mat = mat.assume_safe(); + self.previous_bounciness = save_mat.bounce(); + save_mat.set_bounce(self.target_bounciness); + }, + None => godot_warn!("Physics material was not found") + } + }, + None => godot_warn!("No rigid body initialized to apply properties to") + } + } + + unsafe fn revert_buff(&mut self) { + // make sure the rigid body exists + match &self.rigid_body { + Some(body) => { + let safe_body = body.assume_safe(); + + // get the physics material + match safe_body.physics_material_override() { + Some(mat) => { + let save_mat = mat.assume_safe(); + save_mat.set_bounce(self.previous_bounciness); + }, + None => godot_warn!("Physics material was not found") + } + }, + None => godot_warn!("No rigid body initialized to apply properties to") + } + } + + fn get_name(self) -> GodotString { + GodotString::from_str(self.name) + } + + fn get_description(self) -> GodotString { + GodotString::from_str(self.description) + } +} diff --git a/rust/src/buff_extra.rs b/rust/src/buff_extra.rs new file mode 100644 index 0000000..473cdde --- /dev/null +++ b/rust/src/buff_extra.rs @@ -0,0 +1,35 @@ +use gdnative::api::*; +use gdnative::prelude::*; +use crate::buff_trait::Buff; + +struct BuffExtra { + name: String, + description: String, +} + +impl BuffExtra { + fn new() -> Self { + BuffExtra { + name: String::from("Extra Stroke"), + description: String::from("One additional stroke that doesn't count"), + } + } +} + +impl Buff for BuffExtra { + unsafe fn execute_buff(&mut self) { + todo!() + } + + unsafe fn revert_buff(&mut self) { + todo!() + } + + fn get_name(self) -> GodotString { + GodotString::from_str(self.name) + } + + fn get_description(self) -> GodotString { + GodotString::from_str(self.description) + } +} diff --git a/rust/src/buff_phase.rs b/rust/src/buff_phase.rs new file mode 100644 index 0000000..e64508e --- /dev/null +++ b/rust/src/buff_phase.rs @@ -0,0 +1,60 @@ +use gdnative::api::*; +use gdnative::prelude::*; +use crate::buff_trait::Buff; + +struct BuffPhase { + name: String, + description: String, + rigid_body: Option<Ref<RigidBody>>, + + wall_layer_bit: i64, +} + +impl BuffPhase { + fn new(rigid_body: Option<Ref<RigidBody>>) -> Self { + // calculate the bit for the mask to enable/ disable collision detection + let mask_layer = 2; + let mask_bit = 2_i64.pow(mask_layer - 1); + + BuffPhase { + name: String::from("Phase"), + description: String::from("Phases through thin fences"), + rigid_body, + + wall_layer_bit: mask_bit, + } + } +} + +impl Buff for BuffPhase { + unsafe fn execute_buff(&mut self) { + match &self.rigid_body { + Some(body) => { + // actually disable the collision to the fences + let save_body = body.assume_safe(); + save_body.set_collision_mask_bit(self.wall_layer_bit, false); + }, + None => godot_warn!("Rigid body not found") + } + } + + unsafe fn revert_buff(& mut self) { + // make sure the rigid body exists + match &self.rigid_body { + Some(body) => { + // actually enable the collision again + let save_body = body.assume_safe(); + save_body.set_collision_mask_bit(self.wall_layer_bit, false); + }, + None => godot_warn!("Rigid body not found") + } + } + + fn get_name(self) -> GodotString { + GodotString::from_str(self.name) + } + + fn get_description(self) -> GodotString { + GodotString::from_str(self.description) + } +} diff --git a/rust/src/buff_trait.rs b/rust/src/buff_trait.rs new file mode 100644 index 0000000..d0e9fba --- /dev/null +++ b/rust/src/buff_trait.rs @@ -0,0 +1,9 @@ +use gdnative::api::*; +use gdnative::prelude::*; + +pub trait Buff { + unsafe fn execute_buff(&mut self); + unsafe fn revert_buff(&mut self); + fn get_name(self) -> GodotString; + fn get_description(self) -> GodotString; +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs index de26e5d..30f4f2a 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,5 +1,10 @@ mod game; mod spinning_cube; +mod buff_bounce; +mod buff_phase; +mod buff_trait; +mod buff_ball; +mod buff_extra; mod test; mod basic_die; |