fix: get rid of the resource init warnings
This commit is contained in:
parent
729473dc75
commit
c7879ddc05
@ -10,7 +10,7 @@ pub struct Boid2D {
|
||||
#[export]
|
||||
/// The properties of this boid.
|
||||
/// Note: this cannot be changed in runtime, aside from removing and readding the node.
|
||||
properties: Gd<BoidProperties>,
|
||||
properties: Option<Gd<BoidProperties>>,
|
||||
props: BoidProperties,
|
||||
vel: Vec2,
|
||||
flock_id: Option<InstanceId>,
|
||||
@ -67,7 +67,9 @@ impl INode2D for Boid2D {
|
||||
}
|
||||
|
||||
fn ready(&mut self) {
|
||||
self.props = self.properties.bind().clone();
|
||||
if let Some(props) = self.properties.as_ref() {
|
||||
self.props = props.bind().clone();
|
||||
}
|
||||
}
|
||||
|
||||
fn exit_tree(&mut self) {
|
||||
|
@ -10,7 +10,7 @@ pub struct Boid3D {
|
||||
#[export]
|
||||
/// The properties of this boid.
|
||||
/// Note: this cannot be changed in runtime, aside from removing and readding the node.
|
||||
properties: Gd<BoidProperties>,
|
||||
properties: Option<Gd<BoidProperties>>,
|
||||
props: BoidProperties,
|
||||
vel: Vec3,
|
||||
flock_id: Option<InstanceId>,
|
||||
@ -66,7 +66,9 @@ impl INode3D for Boid3D {
|
||||
}
|
||||
|
||||
fn ready(&mut self) {
|
||||
self.props = self.properties.bind().clone();
|
||||
if let Some(props) = self.properties.as_ref() {
|
||||
self.props = props.bind().clone();
|
||||
}
|
||||
}
|
||||
|
||||
fn exit_tree(&mut self) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use godot::prelude::*;
|
||||
|
||||
#[derive(Default, Clone, Debug, GodotClass)]
|
||||
#[class(tool, init, base=Resource)]
|
||||
#[class(init, base=Resource)]
|
||||
/// Properties for a 2D/3D boid.
|
||||
pub struct BoidProperties {
|
||||
#[export]
|
||||
|
@ -13,7 +13,7 @@ pub struct Flock2D {
|
||||
#[export]
|
||||
/// Properties of this flock.
|
||||
/// Note: this cannot be changed in runtime, aside from removing and readding the node.
|
||||
properties: Gd<FlockProperties>,
|
||||
properties: Option<Gd<FlockProperties>>,
|
||||
props: FlockProperties,
|
||||
#[export]
|
||||
/// A target node for the flock to follow.
|
||||
@ -46,7 +46,9 @@ impl INode2D for Flock2D {
|
||||
}
|
||||
|
||||
fn ready(&mut self) {
|
||||
self.props = self.properties.bind().clone();
|
||||
if let Some(props) = self.properties.as_ref() {
|
||||
self.props = props.bind().clone();
|
||||
}
|
||||
}
|
||||
|
||||
fn exit_tree(&mut self) {
|
||||
|
@ -15,7 +15,7 @@ pub struct Flock3D {
|
||||
#[export]
|
||||
/// Properties of this flock.
|
||||
/// Note: this cannot be changed in runtime, aside from removing and readding the node.
|
||||
properties: Gd<FlockProperties>,
|
||||
properties: Option<Gd<FlockProperties>>,
|
||||
props: FlockProperties,
|
||||
#[export]
|
||||
/// A target node for the flock to follow.
|
||||
@ -48,7 +48,9 @@ impl INode3D for Flock3D {
|
||||
}
|
||||
|
||||
fn ready(&mut self) {
|
||||
self.props = self.properties.bind().clone();
|
||||
if let Some(props) = self.properties.as_ref() {
|
||||
self.props = props.bind().clone();
|
||||
}
|
||||
}
|
||||
|
||||
fn exit_tree(&mut self) {
|
||||
|
Loading…
Reference in New Issue
Block a user