MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / MoveRoom

Method MoveRoom

internal/scripting/actor_func.go:370–400  ·  view source on GitHub ↗
(destRoomId int)

Source from the content-addressed store, hash-verified

368}
369
370func (a ScriptActor) MoveRoom(destRoomId int) {
371
372 if a.userRecord != nil {
373
374 rmNow := rooms.LoadRoom(a.characterRecord.RoomId)
375
376 if rmNext := rooms.LoadRoom(destRoomId); rmNext != nil {
377
378 rooms.MoveToRoom(a.userId, destRoomId)
379
380 for _, mobInstId := range a.characterRecord.GetCharmIds() {
381 rmNow.RemoveMob(mobInstId)
382 rmNext.AddMob(mobInstId)
383 }
384
385 if doLook, err := TryRoomScriptEvent(`onEnter`, a.userRecord.UserId, destRoomId); err != nil || doLook {
386 a.userRecord.CommandFlagged(`look`, events.CmdSecretly) // Do a secret look.
387 }
388 }
389
390 } else if a.mobRecord != nil {
391
392 if mobRoom := rooms.LoadRoom(a.characterRecord.RoomId); mobRoom != nil {
393 if destRoom := rooms.LoadRoom(destRoomId); destRoom != nil {
394 mobRoom.RemoveMob(a.mobInstanceId)
395 destRoom.AddMob(a.mobInstanceId)
396 }
397 }
398
399 }
400}
401
402func (a ScriptActor) UpdateItem(itm ScriptItem) {
403 a.userRecord.Character.UpdateItem(itm.originalItem, *itm.itemRecord)

Callers 11

onCommandFunction · 0.45
onEnterFunction · 0.45
onCommandFunction · 0.45
onCommandFunction · 0.45
onEnterFunction · 0.45
onCommandFunction · 0.45
onCommandFunction · 0.45
onPurchaseFunction · 0.45
onPlayerDownedFunction · 0.45
onIdleFunction · 0.45
onGiveFunction · 0.45

Calls 7

LoadRoomFunction · 0.92
MoveToRoomFunction · 0.92
TryRoomScriptEventFunction · 0.85
GetCharmIdsMethod · 0.80
RemoveMobMethod · 0.80
AddMobMethod · 0.80
CommandFlaggedMethod · 0.45

Tested by

no test coverage detected