From 4b7faa80b3709167566f0b5a4e04df467dd57d21 Mon Sep 17 00:00:00 2001 From: AnturK Date: Fri, 15 Jun 2018 09:10:09 +0200 Subject: [PATCH 1/3] Fixes pubby mapedit. --- _maps/map_files/PubbyStation/PubbyStation.dmm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/_maps/map_files/PubbyStation/PubbyStation.dmm b/_maps/map_files/PubbyStation/PubbyStation.dmm index ea034784926..947513b6d03 100644 --- a/_maps/map_files/PubbyStation/PubbyStation.dmm +++ b/_maps/map_files/PubbyStation/PubbyStation.dmm @@ -31872,9 +31872,7 @@ }, /obj/machinery/atmospherics/components/unary/vent_pump/on, /obj/effect/landmark/blobstart, -/obj/item/melee/baton/cattleprod{ - cell = new /obj/item/stock_parts/cell/high() - }, +/obj/item/melee/baton/cattleprod, /turf/open/floor/plasteel/dark, /area/medical/exam_room) "bEK" = ( From 1a1aa6f12714cbcaf81f1190f50cabddc0395686 Mon Sep 17 00:00:00 2001 From: AnturK Date: Fri, 15 Jun 2018 09:22:21 +0200 Subject: [PATCH 2/3] Actually let's just add this functionality. --- _maps/map_files/PubbyStation/PubbyStation.dmm | 4 +++- code/game/objects/items/stunbaton.dm | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/_maps/map_files/PubbyStation/PubbyStation.dmm b/_maps/map_files/PubbyStation/PubbyStation.dmm index 947513b6d03..dd489845a66 100644 --- a/_maps/map_files/PubbyStation/PubbyStation.dmm +++ b/_maps/map_files/PubbyStation/PubbyStation.dmm @@ -31872,7 +31872,9 @@ }, /obj/machinery/atmospherics/components/unary/vent_pump/on, /obj/effect/landmark/blobstart, -/obj/item/melee/baton/cattleprod, +/obj/item/melee/baton/cattleprod{ + preload_cell_type = /obj/item/stock_parts/cell/high + }, /turf/open/floor/plasteel/dark, /area/medical/exam_room) "bEK" = ( diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index e457ac5c122..51fce664729 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -17,6 +17,7 @@ var/obj/item/stock_parts/cell/high/cell var/hitcost = 1000 var/throw_hit_chance = 35 + var/preload_cell_type //if not empty the baton starts with this type of cell /obj/item/melee/baton/get_cell() return cell @@ -27,6 +28,8 @@ /obj/item/melee/baton/Initialize() . = ..() + if(preload_cell_type && ispath(preload_cell_type,/obj/item/stock_parts/cell)) + cell = new preload_cell_type(src) update_icon() /obj/item/melee/baton/throw_impact(atom/hit_atom) @@ -35,10 +38,8 @@ if(status && prob(throw_hit_chance) && iscarbon(hit_atom)) baton_stun(hit_atom) -/obj/item/melee/baton/loaded/Initialize() //this one starts with a cell pre-installed. - cell = new(src) - update_icon() - . = ..() +/obj/item/melee/baton/loaded //this one starts with a cell pre-installed. + preload_cell_type = /obj/item/stock_parts/cell/high /obj/item/melee/baton/proc/deductcharge(chrgdeductamt) if(cell) From 978bd9227c2fd32c4b9a6f39c52aa6c39d8d25f9 Mon Sep 17 00:00:00 2001 From: AnturK Date: Sat, 16 Jun 2018 11:18:04 +0200 Subject: [PATCH 3/3] Cleanup + warning on wrong pathtype --- code/game/objects/items/stunbaton.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 51fce664729..d6859d1dba3 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -14,7 +14,7 @@ var/stunforce = 140 var/status = 0 - var/obj/item/stock_parts/cell/high/cell + var/obj/item/stock_parts/cell/cell var/hitcost = 1000 var/throw_hit_chance = 35 var/preload_cell_type //if not empty the baton starts with this type of cell @@ -28,8 +28,11 @@ /obj/item/melee/baton/Initialize() . = ..() - if(preload_cell_type && ispath(preload_cell_type,/obj/item/stock_parts/cell)) - cell = new preload_cell_type(src) + if(preload_cell_type) + if(!ispath(preload_cell_type,/obj/item/stock_parts/cell)) + log_world("### MAP WARNING, [src] at [AREACOORD(src)] had an invalid preload_cell_type: [preload_cell_type].") + else + cell = new preload_cell_type(src) update_icon() /obj/item/melee/baton/throw_impact(atom/hit_atom)