Skip to content

Commit 17c0839

Browse files
Allows all kinds of floor tiles to be click dragged, not just metal/plasteel (#38190)
* should be as easy as this but needs testing * more comprehensive * fix * moves this to here too * unused * unused * tries this * now that this actually works on everything, these go unused, so BALEETED * WE NEED THIS * this oughta do it * redundant var
1 parent e06652a commit 17c0839

File tree

4 files changed

+64
-75
lines changed

4 files changed

+64
-75
lines changed

code/_onclick/hud/draggable.dm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/obj/abstract/screen/draggable
2-
icon = 'icons/mob/screen_draggable.dmi'
32
icon_state = "blank"
43
var/mob/attachedmob
54
var/obj/attachedobject
@@ -16,7 +15,6 @@
1615
var/obj/abstract/screen/fuckbyond
1716

1817
/obj/abstract/screen/fuckbyond
19-
icon = 'icons/mob/screen_draggable.dmi'
2018
icon_state = "blank"
2119
mouse_opacity = 0
2220
screen_loc = ui_entire_screen
@@ -49,6 +47,7 @@
4947

5048
//Copy over the icon state to the draggable screen objects.dmi for this to function
5149
name = "[capitalize(attachedobject.name)] Construction"
50+
icon = attachedobject.icon
5251
mouse_over_pointer = "[attachedobject.icon_state]"
5352
mouse_drag_pointer = "[attachedobject.icon_state]"
5453

code/game/objects/items/stacks/tiles/tile_types.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
sheet_type = /obj/item/stack/sheet/wood
4949
material = "wood"
5050

51-
/obj/item/stack/tile/wood/proc/build(turf/S as turf)
51+
/obj/item/stack/tile/wood/build(turf/S as turf)
5252
if(S.air)
5353
var/datum/gas_mixture/GM = S.air
5454
if(GM.pressure > HALF_ATM)

code/game/objects/items/stacks/tiles/tiles.dm

Lines changed: 62 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
var/material
66
var/datum/paint_overlay/paint_overlay = null
77
var/list/stacked_paint = list()
8+
var/active
9+
10+
/obj/item/stack/tile/Destroy()
11+
..()
12+
if(active)
13+
QDEL_NULL(active)
14+
15+
/obj/item/stack/tile/dropped()
16+
..()
17+
if(active)
18+
QDEL_NULL(active)
819

920
/obj/item/stack/tile/transfer_data_from(var/obj/item/stack/tile/S, var/amount)
1021
while(amount > 0)
@@ -67,44 +78,18 @@
6778
stacked_paint.len = 0
6879
update_icon()
6980

70-
/obj/item/stack/tile/metal
71-
name = "floor tile"
72-
singular_name = "floor tile"
73-
desc = "Those could work as a pretty decent throwing weapon."
74-
icon_state = "tile"
75-
w_class = W_CLASS_MEDIUM
76-
force = 6.0
77-
starting_materials = list(MAT_IRON = 937.5)
78-
w_type = RECYK_METAL
79-
melt_temperature = MELTPOINT_STEEL
80-
throwforce = 10
81-
throw_speed = 4
82-
throw_range = 20
83-
flags = FPRINT
84-
siemens_coefficient = 1
85-
max_amount = 60
86-
material = "metal"
87-
var/active
88-
89-
/obj/item/stack/tile/metal/New(var/loc, var/amount=null)
90-
. = ..()
91-
pixel_x = rand(1, 14) * PIXEL_MULTIPLIER
92-
pixel_y = rand(1, 14) * PIXEL_MULTIPLIER
93-
94-
/obj/item/stack/tile/metal/Destroy()
95-
..()
96-
if(active)
97-
QDEL_NULL(active)
81+
/obj/item/stack/tile/proc/build()
82+
return
9883

99-
/obj/item/stack/tile/metal/attack_self(mob/user)
84+
/obj/item/stack/tile/attack_self(mob/user)
10085
if(!active) //Start click drag construction
10186
active = new /obj/abstract/screen/draggable(src, user)
10287
to_chat(user, "Beginning plating construction mode, click and hold to use.")
10388
return
10489
else //End click drag construction, create grille
105-
qdel(active)
90+
QDEL_NULL(active)
10691

107-
/obj/item/stack/tile/metal/can_drag_use(mob/user, turf/T)
92+
/obj/item/stack/tile/can_drag_use(mob/user, turf/T)
10893
if(user.Adjacent(T)) //can we place here
10994
var/canbuild = T.canBuildPlating()
11095
if(canbuild == BUILD_SUCCESS || canbuild == BUILD_IGNORE || T.canBuildFloortile(src.type))
@@ -113,7 +98,7 @@
11398
else
11499
QDEL_NULL(active) //otherwise remove the draggable screen
115100

116-
/obj/item/stack/tile/metal/drag_use(mob/user, turf/T)
101+
/obj/item/stack/tile/drag_use(mob/user, turf/T)
117102
if(T.canBuildFloortile(src.type) && istype(T,/turf/simulated/floor))
118103
var/turf/simulated/floor/F = T
119104
F.make_tiled_floor(src)
@@ -127,15 +112,33 @@
127112
playsound(T, 'sound/weapons/Genhit.ogg', 25, 1)
128113
build(T)
129114

130-
/obj/item/stack/tile/metal/end_drag_use()
131-
active = null
115+
/obj/item/stack/tile/end_drag_use()
116+
QDEL_NULL(active)
132117

133-
/obj/item/stack/tile/metal/dropped()
134-
..()
135-
if(active)
136-
QDEL_NULL(active)
118+
/obj/item/stack/tile/metal
119+
name = "floor tile"
120+
singular_name = "floor tile"
121+
desc = "Those could work as a pretty decent throwing weapon."
122+
icon_state = "tile"
123+
w_class = W_CLASS_MEDIUM
124+
force = 6.0
125+
starting_materials = list(MAT_IRON = 937.5)
126+
w_type = RECYK_METAL
127+
melt_temperature = MELTPOINT_STEEL
128+
throwforce = 10
129+
throw_speed = 4
130+
throw_range = 20
131+
flags = FPRINT
132+
siemens_coefficient = 1
133+
max_amount = 60
134+
material = "metal"
135+
136+
/obj/item/stack/tile/metal/New(var/loc, var/amount=null)
137+
. = ..()
138+
pixel_x = rand(1, 14) * PIXEL_MULTIPLIER
139+
pixel_y = rand(1, 14) * PIXEL_MULTIPLIER
137140

138-
/obj/item/stack/tile/metal/proc/build(turf/S as turf)
141+
/obj/item/stack/tile/metal/build(turf/S as turf)
139142
if(S.air)
140143
var/datum/gas_mixture/GM = S.air
141144
if(GM.pressure > HALF_ATM)
@@ -189,55 +192,42 @@
189192
to_chat(user, "<span class='warning'>The plating is going to need some support.</span>")
190193
return
191194

192-
193-
/obj/item/stack/tile/rglass/afterattack(atom/target, mob/user, adjacent, params)
194-
if(adjacent)
195-
if(isturf(target) || istype(target, /obj/structure/lattice))
196-
var/turf/T = get_turf(target)
197-
switch(T.canBuildPlating())
198-
if(BUILD_SUCCESS)
199-
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
200-
build(T)
201-
use(1)
202-
203195
/obj/item/stack/tile/rglass
204196
name = "glass tile"
205-
singular_name = "tile"
206197
desc = "A relatively clear reinforced glass tile."
207198
icon_state = "tile_rglass"
208199
max_amount = 60
200+
var/air_type = /turf/simulated/floor/glass
201+
var/airless_type = /turf/simulated/floor/glass/airless
209202

210-
/obj/item/stack/tile/rglass/proc/build(turf/S as turf)
203+
/obj/item/stack/tile/rglass/build(turf/S as turf)
211204
var/obj/structure/lattice/L = S.canBuildCatwalk(src)
212205
if(istype(L))
213-
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
214206
qdel(L)
215-
if(S.air)
216-
var/datum/gas_mixture/GM = S.air
217-
if(GM.pressure > HALF_ATM)
218-
S.ChangeTurf(/turf/simulated/floor/glass)
219-
return
220-
S.ChangeTurf(/turf/simulated/floor/glass/airless)
221-
207+
if(S.air)
208+
var/datum/gas_mixture/GM = S.air
209+
if(GM.pressure > HALF_ATM)
210+
S.ChangeTurf(air_type)
211+
return
212+
S.ChangeTurf(airless_type)
222213

214+
/obj/item/stack/tile/rglass/afterattack(atom/target, mob/user, adjacent, params)
215+
if(adjacent)
216+
if(isturf(target) || istype(target, /obj/structure/lattice))
217+
var/turf/T = get_turf(target)
218+
switch(T.canBuildPlating())
219+
if(BUILD_SUCCESS)
220+
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
221+
build(T)
222+
use(1)
223223

224224
/obj/item/stack/tile/rglass/plasma
225225
name = "plasma glass tile"
226226
singular_name = "tile"
227227
desc = "A relatively clear reinforced plasma glass tile."
228228
icon_state = "tile_plasmarglass"
229-
230-
/obj/item/stack/tile/rglass/plasma/build(turf/S as turf)
231-
var/obj/structure/lattice/L = S.canBuildCatwalk(src)
232-
if(istype(L))
233-
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
234-
qdel(L)
235-
if(S.air)
236-
var/datum/gas_mixture/GM = S.air
237-
if(GM.pressure > HALF_ATM)
238-
S.ChangeTurf(/turf/simulated/floor/glass/plasma)
239-
return
240-
S.ChangeTurf(/turf/simulated/floor/glass/plasma/airless)
229+
air_type = /turf/simulated/floor/glass/plasma
230+
airless_type = /turf/simulated/floor/glass/plasma/airless
241231

242232
/obj/item/stack/tile/metal/plasteel
243233
name = "reinforced floor tile"

icons/mob/screen_draggable.dmi

-1.29 KB
Binary file not shown.

0 commit comments

Comments
 (0)