Graffiti centers on where you click. (#9255)

* Graffiti centers on where you click.

* Oversights, and pixelshifted engravings.

* Better returns
This commit is contained in:
Mechoid
2023-12-27 21:41:07 -08:00
committed by GitHub
parent 14c681720d
commit e976eaba4e
10 changed files with 122 additions and 22 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/turf/simulated/floor/attackby(var/obj/item/C, var/mob/user)
/turf/simulated/floor/attackby(var/obj/item/C, var/mob/user, attack_modifier, click_parameters)
if(!C || !user)
return 0
@@ -29,7 +29,7 @@
if(isliving(user))
var/mob/living/L = user
if(L.a_intent == I_HELP && L.is_preference_enabled(/datum/client_preference/engrave_graffiti))
try_graffiti(L, C)
try_graffiti(L, C, click_parameters)
if(istype(C, /obj/item/stack/tile/roofing))
var/expended_tile = FALSE // To track the case. If a ceiling is built in a multiz zlevel, it also necessarily roofs it against weather
+3 -3
View File
@@ -127,12 +127,12 @@
return success_smash(user)
return fail_smash(user)
/turf/simulated/wall/attackby(var/obj/item/W, var/mob/user)
/turf/simulated/wall/attackby(var/obj/item/W, var/mob/user, attack_modifier, click_parameters)
user.setClickCooldown(user.get_attack_speed(W))
if(!construction_stage && user.a_intent == I_HELP && user.is_preference_enabled(/datum/client_preference/engrave_graffiti))
if(try_graffiti(user,W))
if(try_graffiti(user,W,click_parameters))
return
if (!user.IsAdvancedToolUser())
@@ -405,4 +405,4 @@
return
else if(!istype(W,/obj/item/rcd) && !istype(W, /obj/item/reagent_containers))
return attack_hand(user)
return attack_hand(user)
+13 -1
View File
@@ -308,7 +308,7 @@
/turf/proc/can_engrave()
return FALSE
/turf/proc/try_graffiti(var/mob/vandal, var/obj/item/tool)
/turf/proc/try_graffiti(var/mob/vandal, var/obj/item/tool, click_parameters)
if(!tool.sharp || !can_engrave())
return FALSE
@@ -341,6 +341,18 @@
graffiti.message = message
graffiti.author = vandal.ckey
if(click_parameters)
var/list/mouse_control = params2list(click_parameters)
var/p_x = 0
var/p_y = 0
if(mouse_control["icon-x"])
p_x = text2num(mouse_control["icon-x"]) - 16
if(mouse_control["icon-y"])
p_y = text2num(mouse_control["icon-y"]) - 16
graffiti.pixel_x = p_x
graffiti.pixel_y = p_y
if(lowertext(message) == "elbereth")
to_chat(vandal, "<span class='notice'>You feel much safer.</span>")