Skip to content

Commit

Permalink
prevents bad vars being touched (#3932)
Browse files Browse the repository at this point in the history
apparently this wasn't ported with the rest of the vv refactor whoops!

:cl:
admin: you can no longer touch bad vars
/:cl:
  • Loading branch information
harryob authored Jul 20, 2023
1 parent 07878a3 commit ae6715b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@
var/client/C = usr.client
C?.open_particle_editor(src)

/atom/movable/vv_edit_var(var_name, var_value)
var/static/list/banned_edits = list(NAMEOF_STATIC(src, step_x) = TRUE, NAMEOF_STATIC(src, step_y) = TRUE, NAMEOF_STATIC(src, step_size) = TRUE, NAMEOF_STATIC(src, bounds) = TRUE)
var/static/list/careful_edits = list(NAMEOF_STATIC(src, bound_x) = TRUE, NAMEOF_STATIC(src, bound_y) = TRUE, NAMEOF_STATIC(src, bound_width) = TRUE, NAMEOF_STATIC(src, bound_height) = TRUE)
var/static/list/not_falsey_edits = list(NAMEOF_STATIC(src, bound_width) = TRUE, NAMEOF_STATIC(src, bound_height) = TRUE)
if(banned_edits[var_name])
return FALSE //PLEASE no.
if(careful_edits[var_name] && (var_value % world.icon_size) != 0)
return FALSE
if(not_falsey_edits[var_name] && !var_value)
return FALSE

if(!isnull(.))
datum_flags |= DF_VAR_EDITED
return

return ..()

//when a mob interact with something that gives them a special view,
//check_eye() is called to verify that they're still eligible.
//if they are not check_eye() usually reset the mob's view.
Expand Down
6 changes: 6 additions & 0 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
VV_DROPDOWN_OPTION(VV_HK_EXPLODE, "Trigger Explosion")
VV_DROPDOWN_OPTION(VV_HK_EMPULSE, "Trigger EM Pulse")

/turf/vv_edit_var(var_name, new_value)
var/static/list/banned_edits = list(NAMEOF_STATIC(src, x), NAMEOF_STATIC(src, y), NAMEOF_STATIC(src, z))
if(var_name in banned_edits)
return FALSE
. = ..()

/turf/ex_act(severity)
return 0

Expand Down

0 comments on commit ae6715b

Please sign in to comment.