Skip to content

Commit 4c4ed75

Browse files
use snake case for new decorator code
1 parent 50fca58 commit 4c4ed75

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

misc/decorators.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ export function enumeration<T extends godot.Object>(enumeration: string[], defau
113113
}
114114
}
115115

116-
function makeRpcModeConfigDecorator(mode: godot.MultiplayerAPI.RPCMode) {
116+
function make_rpc_mode_config_decorator(mode: godot.MultiplayerAPI.RPCMode) {
117117
return function <T extends godot.Node>(target: T, property: string, descriptor?: any) {
118-
const isMethod = typeof target[property] === 'function';
119-
const originalReady = target._ready;
118+
const is_method = typeof target[property] === 'function';
119+
const original_ready = target._ready;
120120
target._ready = function (this: godot.Node) {
121-
if (isMethod) this.rpc_config(property, mode);
121+
if (is_method) this.rpc_config(property, mode);
122122
else this.rset_config(property, mode);
123-
if (originalReady) return originalReady.call(this);
123+
if (original_ready) return original_ready.call(this);
124124
};
125125
return descriptor;
126126
}
@@ -132,41 +132,41 @@ function makeRpcModeConfigDecorator(mode: godot.MultiplayerAPI.RPCMode) {
132132
* Analogous to the `remote` keyword. Calls and property changes are accepted from all
133133
* remote peers, no matter if they are node's master or puppets.
134134
*/
135-
export const remote = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_REMOTE)
135+
export const remote = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_REMOTE)
136136
/**
137137
* Used with `Node.rpc_config` or `Node.rset_config` to set a method to be called or
138138
* a property to be changed only on the network master for this node.
139139
* Analogous to the `master` keyword. Only accepts calls or property changes from the
140140
* node's network puppets, see `Node.set_network_master`.
141141
*/
142-
export const master = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_MASTER)
142+
export const master = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_MASTER)
143143
/**
144144
* Used with `Node.rpc_config` or `Node.rset_config` to set a method to be called or
145145
* a property to be changed only on puppets for this node.
146146
* Analogous to the `puppet` keyword. Only accepts calls or property changes from the
147147
* node's network master, see `Node.set_network_master`.
148148
*/
149-
export const puppet = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_PUPPET)
149+
export const puppet = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_PUPPET)
150150
/**
151151
* @deprecated Use `RPC_MODE_PUPPET` (@puppet) instead. Analogous to the `slave` keyword.
152152
*/
153-
export const slave = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_SLAVE)
153+
export const slave = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_SLAVE)
154154
/**
155155
* Behave like `RPC_MODE_REMOTE` (@remote) but also make the call or property change locally.
156156
* Analogous to the `remotesync` keyword.
157157
*/
158-
export const remote_sync = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_REMOTESYNC)
158+
export const remote_sync = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_REMOTESYNC)
159159
/**
160160
* @deprecated Use `RPC_MODE_REMOTESYNC` (@remote_sync) instead. Analogous to the `sync` keyword
161161
*/
162-
export const sync = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_REMOTESYNC)
162+
export const sync = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_REMOTESYNC)
163163
/**
164164
* Behave like `RPC_MODE_MASTER` (@master) but also make the call or property change locally.
165165
* Analogous to the `mastersync` keyword.
166166
*/
167-
export const master_sync = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_MASTERSYNC)
167+
export const master_sync = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_MASTERSYNC)
168168
/**
169169
* Behave like `RPC_MODE_PUPPET` (@puppet) but also make the call or property change locally.
170170
* Analogous to the `puppetsync` keyword.
171171
*/
172-
export const puppet_sync = makeRpcModeConfigDecorator(godot.MultiplayerAPI.RPC_MODE_PUPPETSYNC)
172+
export const puppet_sync = make_rpc_mode_config_decorator(godot.MultiplayerAPI.RPC_MODE_PUPPETSYNC)

0 commit comments

Comments
 (0)