However, when I reached the section on mouse handling, I encountered a need to convert the `params` argument into a list. To achieve this, I used `params2list(params)` and stored it in a variable. Here’s the code I came up with:
atom/proc/MouseDrag(x, y, button, control, params)
var/list/param_list = params2list(params) // Convert params to a list
var/button_dragged = param_list["button"] // Access 'button' from the list
if(button_dragged == "left")
usr << "Dragging with the left mouse button."
And I couldn't "right" click until I disabled popup_menu_setting in client.
This got me wondering how many other developers have done something similar when they first started programming.
Here’s a small game logic example I worked on, where players can interact with different turfs to start or finish a game:
turf
icon='icons.dmi'
icon_state="grass"
mob
icon='icons.dmi'
icon_state="icon"
var/game_start=0
turf/wall1
icon='icons.dmi'
icon_state="wall"
MouseEntered()
if(usr.game_start)
usr << "You lose the game!"
usr.game_start = 0
turf/game_start
icon='icons.dmi'
icon_state="game_start"
MouseEntered()
if(!usr.game_start)
usr << "You start the game."
usr.game_start = 1
turf/game_finish
icon='icons.dmi'
icon_state="game_finish"
MouseEntered()
if(usr.game_start)
usr << "You finish the game!"
usr.game_start = 0
Just a bit of fun! Let me know if you’ve ever gone through similar realizations when starting out with programming.
I didn't believe in Black Holes until I heard this fact: Singularities, such as those at the center of black holes, are indeed thought to have no volume and are infinitely dense. The idea comes from the fact that, according to general relativity, all the mass of a black hole is compressed into an infinitely small point, known as the "singularity." Because the singularity occupies no space, its density—mass per unit volume—becomes infinite.