Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/playground/blocks/hardware/block_KKMOO.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,16 @@ Entry.kkmoo.getBlocks = function () {
class: 'Make_Motion',
isNotFor: ['kkmoo'],
func: function (sprite, script) {
const motnum = script.getField('MOTNUM', script);
const motnum = Number(script.getField('MOTNUM', script));
const angle = script.getValue('ANGLE', script);
Entry.hw.update();
if (
!Number.isInteger(motnum) ||
motnum < 0 ||
motnum >= Entry.kkmoo.motData.length
) {
return script;
}
if (script.isStart != true) {
script.isStart = true;
if (angle >= -90 && angle <= 90) {
Expand Down Expand Up @@ -853,8 +860,15 @@ Entry.kkmoo.getBlocks = function () {
class: 'Save_Motion',
isNotFor: ['kkmoo'],
func: function (sprite, script) {
const motnum = script.getField('FRAME', script);
const motnum = Number(script.getField('FRAME', script));
Entry.hw.update();
if (
!Number.isInteger(motnum) ||
motnum < 0 ||
motnum >= Entry.kkmoo.motionFrame.length
) {
return script;
}
if (script.isStart != true) {
script.isStart = true;
var data = Entry.kkmoo.copyObj(Entry.kkmoo.motData);
Expand Down Expand Up @@ -972,9 +986,16 @@ Entry.kkmoo.getBlocks = function () {
class: 'Save_Motion',
isNotFor: ['kkmoo'],
func: function (sprite, script) {
const motnum = script.getField('FRAME', script);
const motnum = Number(script.getField('FRAME', script));
const time = script.getValue('TIME', script);
Entry.hw.update();
if (
!Number.isInteger(motnum) ||
motnum < 0 ||
motnum >= Entry.kkmoo.motionFrame.length
) {
return script;
}
if (script.isStart != true) {
script.isStart = true;
Entry.kkmoo.motionFrame[motnum].time = time;
Expand Down
6 changes: 5 additions & 1 deletion src/playground/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ class Scope {
static _reservedKeywords = new Set(['__proto__']);

filterReservedKeywords(param) {
return Scope._reservedKeywords.has(param) ? '' : param;
// 배열/객체를 객체 키로 사용할 때 toString 변환(예: ["__proto__"] → "__proto__")으로
// 예약어를 우회하는 것을 차단한다.
const normalized =
typeof param === 'object' && param !== null ? String(param) : param;
Comment on lines +32 to +33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Delete ⏎···········

Suggested change
const normalized =
typeof param === 'object' && param !== null ? String(param) : param;
const normalized = typeof param === 'object' && param !== null ? String(param) : param;

return Scope._reservedKeywords.has(normalized) ? '' : param;
}

getParams() {
Expand Down
Loading