@@ -8,15 +8,6 @@ use crate::{prelude::ByondValue, static_global::byond, Error};
88pub struct ByondXYZ ( CByondXYZ ) ;
99
1010impl ByondXYZ {
11- pub fn new ( ) -> Self {
12- Self ( CByondXYZ {
13- x : 0 ,
14- y : 0 ,
15- z : 0 ,
16- junk : 0 ,
17- } )
18- }
19-
2011 pub fn with_coords ( ( x, y, z) : ( i16 , i16 , i16 ) ) -> Self {
2112 Self ( CByondXYZ { x, y, z, junk : 0 } )
2213 }
@@ -27,7 +18,12 @@ impl ByondXYZ {
2718
2819impl Default for ByondXYZ {
2920 fn default ( ) -> Self {
30- Self :: new ( )
21+ Self ( CByondXYZ {
22+ x : 0 ,
23+ y : 0 ,
24+ z : 0 ,
25+ junk : 0 ,
26+ } )
3127 }
3228}
3329
@@ -76,7 +72,7 @@ pub fn byond_block(corner1: ByondXYZ, corner2: ByondXYZ) -> Result<Vec<ByondValu
7672/// Corresponds to the first variation of [`dm::locate(Type) in Container`](https://www.byond.com/docs/ref/#/proc/locate)
7773/// Finds an object prototype or tag within the haystack, usually used for finding objects within a turf/area/etc
7874pub fn byond_locatein ( needle : & ByondValue , haystack : & ByondValue ) -> Result < ByondValue , Error > {
79- let mut output = ByondValue :: new ( ) ;
75+ let mut output = ByondValue :: default ( ) ;
8076
8177 // Safety: needle, haystack, and output must be initialized, we take care of this.
8278 unsafe { map_byond_error ! ( byond( ) . Byond_LocateIn ( & needle. 0 , & haystack. 0 , & mut output. 0 ) ) ? } ;
@@ -87,7 +83,7 @@ pub fn byond_locatein(needle: &ByondValue, haystack: &ByondValue) -> Result<Byon
8783/// Corresponds to the third and forth variation of [`dm::locate(Tag/TextRef)`](https://www.byond.com/docs/ref/#/proc/locate)
8884/// Finds an object prototype or tag within the world.
8985pub fn byond_locateby ( target : & ByondValue ) -> Result < ByondValue , Error > {
90- let mut output = ByondValue :: new ( ) ;
86+ let mut output = ByondValue :: default ( ) ;
9187
9288 // Safety: target and output must be initialized, we take care of this.
9389 unsafe {
@@ -100,7 +96,7 @@ pub fn byond_locateby(target: &ByondValue) -> Result<ByondValue, Error> {
10096/// Corresponds to the second variation of [`dm::locate(X,Y,Z)`](https://www.byond.com/docs/ref/#/proc/locate)
10197/// Finds a turf at the given coordinates.
10298pub fn byond_locatexyz ( coords : ByondXYZ ) -> Result < ByondValue , Error > {
103- let mut output = ByondValue :: new ( ) ;
99+ let mut output = ByondValue :: default ( ) ;
104100
105101 // Safety: coords and output must be initialized, we take care of this.
106102 unsafe { map_byond_error ! ( byond( ) . Byond_LocateXYZ ( & coords. 0 , & mut output. 0 ) ) ? } ;
@@ -111,7 +107,7 @@ pub fn byond_locatexyz(coords: ByondXYZ) -> Result<ByondValue, Error> {
111107/// Corresponds to accessing [`atom.loc`](https://www.byond.com/docs/ref/#/atom/var/loc)
112108/// Gets the location of the target, which will be 0,0,0 if the atom is not directly on a turf.
113109pub fn byond_xyz ( target : & ByondValue ) -> Result < ByondXYZ , Error > {
114- let mut output = ByondXYZ :: new ( ) ;
110+ let mut output = ByondXYZ :: default ( ) ;
115111
116112 // Safety: target and output must be initialized, we take care of this.
117113 unsafe { map_byond_error ! ( byond( ) . Byond_XYZ ( & target. 0 , & mut output. 0 ) ) ? } ;
0 commit comments