diff --git a/.gitignore b/.gitignore index a4634f3fc84..d9f4a187400 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ data/ *.db stddef.dm .atom-build.json -*.vscode/* \ No newline at end of file +*.vscode/* +!/.vscode/extensions.json \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 146be925c77..5a731170a79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,4 +69,4 @@ jobs: - npm install --loglevel=error before_script: script: - - gulp + - node node_modules/gulp/bin/gulp.js --require less-loader diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000000..9099488143b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "gbasood.byond-dm-language-support", + "platymuus.dm-langclient" + ] +} diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index 01f83ba0194..837f8f440d6 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -97,7 +97,7 @@ CREATE TABLE `customuseritems` ( `cuiPropAdjust` text, `cuiJobMask` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=56 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -124,7 +124,7 @@ CREATE TABLE `death` ( `fireloss` int(11) NOT NULL, `oxyloss` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=166546 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=166546 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -160,7 +160,7 @@ CREATE TABLE `admin` ( `level` int(2) NOT NULL DEFAULT '0', `flags` int(16) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -177,7 +177,7 @@ CREATE TABLE `admin_log` ( `adminip` varchar(18) NOT NULL, `log` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -212,7 +212,7 @@ CREATE TABLE `ban` ( `unbanned_computerid` varchar(32) DEFAULT NULL, `unbanned_ip` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=10685 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=10685 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -230,7 +230,7 @@ CREATE TABLE `feedback` ( `var_value` int(16) DEFAULT NULL, `details` text, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=257638 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=257638 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -272,7 +272,7 @@ CREATE TABLE `player` ( `parallax` tinyint(1) DEFAULT '8', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) -) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -293,7 +293,7 @@ CREATE TABLE `poll_option` ( `descmid` varchar(32) DEFAULT NULL, `descmax` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -314,7 +314,7 @@ CREATE TABLE `poll_question` ( `createdby_ckey` varchar(45) NULL DEFAULT NULL, `createdby_ip` varchar(45) NULL DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -333,7 +333,7 @@ CREATE TABLE `poll_textreply` ( `replytext` text NOT NULL, `adminrank` varchar(32) NOT NULL DEFAULT 'Player', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -353,7 +353,7 @@ CREATE TABLE `poll_vote` ( `adminrank` varchar(32) NOT NULL, `rating` int(2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -369,7 +369,7 @@ CREATE TABLE `privacy` ( `consent` bit(1) NOT NULL, PRIMARY KEY (`ckey`), UNIQUE KEY `ckey_UNIQUE` (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -391,7 +391,7 @@ CREATE TABLE `karma` ( `spenderip` text NOT NULL, `time` datetime NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=73614 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=73614 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -407,7 +407,7 @@ CREATE TABLE `karmatotals` ( `karma` int(11) NOT NULL, `karmaspent` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=6765 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=6765 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -426,7 +426,7 @@ CREATE TABLE `library` ( `ckey` varchar(45) NOT NULL, `flagged` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=929 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=929 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -442,7 +442,7 @@ CREATE TABLE `legacy_population` ( `admincount` int(11) DEFAULT NULL, `time` datetime NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2550 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=2550 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -458,7 +458,7 @@ CREATE TABLE `whitelist` ( `job` text, `species` text, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=877 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=877 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -485,7 +485,7 @@ CREATE TABLE `watch` ( `last_editor` varchar(32), `edits` text, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; @@ -507,7 +507,7 @@ CREATE TABLE `notes` ( `server` varchar(50) NOT NULL, `crew_playtime` mediumint(8) UNSIGNED DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -524,7 +524,7 @@ CREATE TABLE `memo` ( `last_editor` varchar(32), `edits` text, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -538,7 +538,7 @@ CREATE TABLE `ipintel` ( `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL, `intel` real NOT NULL DEFAULT '0', PRIMARY KEY (`ip`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -551,7 +551,7 @@ CREATE TABLE `vpn_whitelist` ( `ckey` varchar(32) NOT NULL, `reason` text, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -564,7 +564,7 @@ CREATE TABLE `oauth_tokens` ( `ckey` varchar(32) NOT NULL, `token` varchar(32) NOT NULL, PRIMARY KEY (`token`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; @@ -580,7 +580,7 @@ CREATE TABLE `playtime_history` ( `time_living` SMALLINT NOT NULL, `time_ghost` SMALLINT NOT NULL, PRIMARY KEY (`ckey`, `date`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- @@ -594,4 +594,4 @@ CREATE TABLE `connection_log` ( `ip` varchar(32) NOT NULL, `computerid` varchar(32) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index 9801c54d6f9..b43141f6784 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -97,7 +97,7 @@ CREATE TABLE `SS13_customuseritems` ( `cuiPropAdjust` text, `cuiJobMask` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=56 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -124,7 +124,7 @@ CREATE TABLE `SS13_death` ( `fireloss` int(11) NOT NULL, `oxyloss` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=166546 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=166546 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -159,7 +159,7 @@ CREATE TABLE `SS13_admin` ( `level` int(2) NOT NULL DEFAULT '0', `flags` int(16) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -176,7 +176,7 @@ CREATE TABLE `SS13_admin_log` ( `adminip` varchar(18) NOT NULL, `log` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -211,7 +211,7 @@ CREATE TABLE `SS13_ban` ( `unbanned_computerid` varchar(32) DEFAULT NULL, `unbanned_ip` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=10685 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=10685 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -229,7 +229,7 @@ CREATE TABLE `SS13_feedback` ( `var_value` int(16) DEFAULT NULL, `details` text, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=257638 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=257638 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -271,7 +271,7 @@ CREATE TABLE `SS13_player` ( `parallax` tinyint(1) DEFAULT '8', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) -) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -292,7 +292,7 @@ CREATE TABLE `SS13_poll_option` ( `descmid` varchar(32) DEFAULT NULL, `descmax` varchar(32) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -313,7 +313,7 @@ CREATE TABLE `SS13_poll_question` ( `createdby_ckey` varchar(45) NULL DEFAULT NULL, `createdby_ip` varchar(45) NULL DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -332,7 +332,7 @@ CREATE TABLE `SS13_poll_textreply` ( `replytext` text NOT NULL, `adminrank` varchar(32) NOT NULL DEFAULT 'Player', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -352,7 +352,7 @@ CREATE TABLE `SS13_poll_vote` ( `adminrank` varchar(32) NOT NULL, `rating` int(2) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -368,7 +368,7 @@ CREATE TABLE `ss13_privacy` ( `consent` bit(1) NOT NULL, PRIMARY KEY (`ckey`), UNIQUE KEY `ckey_UNIQUE` (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -390,7 +390,7 @@ CREATE TABLE `SS13_karma` ( `spenderip` text NOT NULL, `time` datetime NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=73614 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=73614 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -406,7 +406,7 @@ CREATE TABLE `SS13_karmatotals` ( `karma` int(11) NOT NULL, `karmaspent` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=6765 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=6765 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -425,7 +425,7 @@ CREATE TABLE `SS13_library` ( `ckey` varchar(45) NOT NULL, `flagged` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=929 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=929 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -441,7 +441,7 @@ CREATE TABLE `SS13_legacy_population` ( `admincount` int(11) DEFAULT NULL, `time` datetime NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2550 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=2550 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -457,7 +457,7 @@ CREATE TABLE `SS13_whitelist` ( `job` text, `species` text, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=877 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=877 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -484,7 +484,7 @@ CREATE TABLE `SS13_watch` ( `last_editor` varchar(32), `edits` text, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; @@ -506,7 +506,7 @@ CREATE TABLE `SS13_notes` ( `server` varchar(50) NOT NULL, `crew_playtime` mediumint(8) UNSIGNED DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -523,7 +523,7 @@ CREATE TABLE `SS13_memo` ( `last_editor` varchar(32), `edits` text, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -537,7 +537,7 @@ CREATE TABLE `SS13_ipintel` ( `date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL, `intel` real NOT NULL DEFAULT '0', PRIMARY key (`ip`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -550,7 +550,7 @@ CREATE TABLE `SS13_vpn_whitelist` ( `ckey` varchar(32) NOT NULL, `reason` text, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -563,7 +563,7 @@ CREATE TABLE `SS13_oauth_tokens` ( `ckey` varchar(32) NOT NULL, `token` varchar(32) NOT NULL, PRIMARY KEY (`token`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -578,7 +578,7 @@ CREATE TABLE `SS13_playtime_history` ( `time_living` SMALLINT NOT NULL, `time_ghost` SMALLINT NOT NULL, PRIMARY KEY (`ckey`, `date`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Table structure for table `SS13_connection_log` @@ -591,4 +591,4 @@ CREATE TABLE `SS13_connection_log` ( `ip` varchar(32) NOT NULL, `computerid` varchar(32) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/SQL/updates/10-11.sql b/SQL/updates/10-11.sql new file mode 100644 index 00000000000..9564d3efaad --- /dev/null +++ b/SQL/updates/10-11.sql @@ -0,0 +1,41 @@ +# Updating SQL from ver 10 to 11 +# Changes tables from latin1 to utf8mb4 +# Based on: https://github.com/BeeStation/BeeStation-Hornet/pull/1074/files +# -Kyet + +# Generation (not necessary to run unless your DB has extra tables) +SELECT CONCAT("ALTER TABLE ", TABLE_SCHEMA, '.', TABLE_NAME," CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") AS ExecuteTheString +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA="feedback" +AND TABLE_TYPE="BASE TABLE"; + +# Actual table conversion stuff +ALTER TABLE feedback.admin CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.admin_log CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.ban CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.characters CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.connection_log CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.customuseritems CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.death CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.donators CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.erro_privacy CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.feedback CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.ipintel CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.karma CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.karmatotals CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.legacy_population CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.library CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.memo CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.notes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.oauth_tokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.player CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.playtime_history CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.poll_option CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.poll_question CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.poll_textreply CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.poll_vote CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.population CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.privacy CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.vpn_whitelist CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.watch CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE feedback.whitelist CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; \ No newline at end of file diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 0c1b0a35426..157b0312995 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -64,8 +64,8 @@ GLOBAL_DATUM_INIT(pipe_icon_manager, /datum/pipe_icon_manager, new()) // Icons/overlays/underlays /obj/machinery/atmospherics/update_icon() - var/turf/T = loc - if(level == 2 || !T.intact) + var/turf/T = get_turf(loc) + if(!T || level == 2 || !T.intact) plane = GAME_PLANE else plane = FLOOR_PLANE diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index a8bd792daa0..fbba6f809ed 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -98,16 +98,16 @@ else return "South" -/obj/machinery/atmospherics/binary/circulator/attackby(obj/item/W as obj, mob/user as mob, params) - if(ismultitool(W)) - if(side_inverted == 0) - side_inverted = 1 - else - side_inverted = 0 - to_chat(user, "You reverse the circulator's valve settings. The inlet of the circulator is now on the [get_inlet_side(dir)] side.") - desc = "A gas circulator pump and heat exchanger. Its input port is on the [get_inlet_side(dir)] side, and its output port is on the [get_outlet_side(dir)] side." +/obj/machinery/atmospherics/binary/circulator/multitool_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(!side_inverted) + side_inverted = TRUE else - return ..() + side_inverted = FALSE + to_chat(user, "You reverse the circulator's valve settings. The inlet of the circulator is now on the [get_inlet_side(dir)] side.") + desc = "A gas circulator pump and heat exchanger. Its input port is on the [get_inlet_side(dir)] side, and its output port is on the [get_outlet_side(dir)] side." /obj/machinery/atmospherics/binary/circulator/update_icon() ..() diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index 1b920002227..afdca1d19ce 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -344,27 +344,6 @@ playsound(loc, 'sound/weapons/bladeslice.ogg', 100, TRUE) /obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = W - if(WT.remove_fuel(0,user)) - to_chat(user, "Now welding the vent.") - if(do_after(user, 20 * WT.toolspeed, target = src)) - if(!src || !WT.isOn()) return - playsound(src.loc, WT.usesound, 50, 1) - if(!welded) - user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.") - welded = 1 - update_icon() - else - user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.") - welded = 0 - update_icon() - else - to_chat(user, "The welding tool needs to be on to start this task.") - return 1 - else - to_chat(user, "You need more welding fuel to complete this task.") - return 1 if(istype(W, /obj/item/screwdriver)) if(!welded) if(open) @@ -400,6 +379,23 @@ return ..() +/obj/machinery/atmospherics/unary/vent_pump/welder_act(mob/user, obj/item/I) + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_WELD_MESSAGE + if(I.use_tool(src, user, 20, volume = I.tool_volume)) + if(!welded) + welded = TRUE + visible_message("[user] welds [src] shut!",\ + "You weld [src] shut!") + else + welded = FALSE + visible_message("[user] unwelds [src]!",\ + "You unweld [src]!") + update_icon() + + /obj/machinery/atmospherics/unary/vent_pump/attack_hand() if(!welded) if(open) diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm index 5fcf7817a30..d9aff36688b 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -393,27 +393,6 @@ playsound(loc, 'sound/weapons/bladeslice.ogg', 100, TRUE) /obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/W as obj, var/mob/user as mob, params) - if(istype(W, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = W - if(WT.remove_fuel(0,user)) - to_chat(user, "Now welding the scrubber.") - if(do_after(user, 20 * WT.toolspeed, target = src)) - if(!src || !WT.isOn()) return - playsound(get_turf(src), WT.usesound, 50, 1) - if(!welded) - user.visible_message("[user] welds the scrubber shut.", "You weld the vent scrubber.", "You hear welding.") - welded = 1 - update_icon() - else - user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.") - welded = 0 - update_icon() - else - to_chat(user, "The welding tool needs to be on to start this task.") - return 1 - else - to_chat(user, "You need more welding fuel to complete this task.") - return 1 if(istype(W, /obj/item/multitool)) update_multitool_menu(user) return 1 @@ -423,3 +402,19 @@ return 1 return ..() + +/obj/machinery/atmospherics/unary/vent_scrubber/welder_act(mob/user, obj/item/I) + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_WELD_MESSAGE + if(I.use_tool(src, user, 20, volume = I.tool_volume)) + if(!welded) + welded = TRUE + visible_message("[user] welds [src] shut!",\ + "You weld [src] shut!") + else + welded = FALSE + visible_message("[user] unwelds [src]!",\ + "You unweld [src]!") + update_icon() diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 69e89020431..9ff3345cfab 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -319,7 +319,7 @@ #define INVESTIGATE_BOMB "bombs" // The SQL version required by this version of the code -#define SQL_VERSION 10 +#define SQL_VERSION 11 // Vending machine stuff #define CAT_NORMAL 1 diff --git a/code/__DEFINES/tools.dm b/code/__DEFINES/tools.dm new file mode 100644 index 00000000000..d0204e1d013 --- /dev/null +++ b/code/__DEFINES/tools.dm @@ -0,0 +1,46 @@ +#define TOOL_CROWBAR "crowbar" +#define TOOL_MULTITOOL "multitool" +#define TOOL_SCREWDRIVER "screwdriver" +#define TOOL_WIRECUTTER "wirecutter" +#define TOOL_WRENCH "wrench" +#define TOOL_WELDER "welder" + +#define MIN_TOOL_SOUND_DELAY 20 + +//Crowbar messages +#define CROWBAR_ATTEMPT_PRY_CIRCUIT_MESSAGE user.visible_message("[user] begins removing the circuit board from [src]...", "You begin removing the circuit board from [src]...", "You hear prying noises.") +#define CROWBAR_PRY_CIRCUIT_SUCCESS_MESSAGE user.visible_message("[user] pries out the circuit board from [src]!", "You pry out the circuit board from [src]!", "You hear prying noises.") + +//Screwdriver messages +#define SCREWDRIVER_SCREW_MESSAGE user.visible_message("[user] tightens the screws on [src]!", "You tighten the screws on [src]!", "You hear a screwdriver.") +#define SCREWDRIVER_UNSCREW_MESSAGE user.visible_message("[user] loosens the screws on [src]!", "You loosen the screws on [src]!", "You hear a screwdriver.") +#define SCREWDRIVER_OPEN_PANEL_MESSAGE user.visible_message("[user] opens the panel on [src]!", "You open the panel on [src]!", "You hear a screwdriver.") +#define SCREWDRIVER_CLOSE_PANEL_MESSAGE user.visible_message("[user] closes the panel on [src]!", "You close the panel on [src]!", "You hear a screwdriver.") + +//Wirecutter messages +#define WIRECUTTER_SNIP_MESSAGE user.visible_message("[user] cuts the wires from [src]!", "You cut the wires from [src]!", "You hear snipping.") +#define WIRECUTTER_ATTEMPT_DISMANTLE_MESSAGE user.visible_message("[user] begins cutting [src] apart... ", "You begin cutting [src] apart...", "You hear snipping.") +#define WIRECUTTER_DISMANTLE_SUCCESS_MESSAGE user.visible_message("[user] cuts [src] apart!", "You cut [src] apart!", "You hear snipping.") + +//Welder messages and other stuff +#define HEALPERWELD 15 +#define WELDER_ATTEMPT_WELD_MESSAGE user.visible_message("[user] begins welding [src]...", "You begin welding [src]...", "You hear welding.") +#define WELDER_WELD_SUCCESS_MESSAGE to_chat(user, "You finish welding [src]!") +#define WELDER_ATTEMPT_REPAIR_MESSAGE user.visible_message("[user] begins repairing the damage on [src]...", "You begin repairing [src]...", "You hear welding.") +#define WELDER_REPAIR_SUCCESS_MESSAGE to_chat(user, "You repair the damage on [src]!") +#define WELDER_ATTEMPT_SLICING_MESSAGE user.visible_message("[user] begins slicing through [src]...", "You begin slicing through [src]...", "You hear welding.") +#define WELDER_SLICING_SUCCESS_MESSAGE to_chat(user, "You slice clean through [src]!") +#define WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE user.visible_message("[user] begins slicing [src] free from [get_turf(src)]...", "You begin slicing [src] free from [get_turf(src)]...", "You hear welding.") +#define WELDER_FLOOR_SLICE_SUCCESS_MESSAGE to_chat(user, "You slice [src] clear of [get_turf(src)]!") +#define WELDER_ATTEMPT_FLOOR_WELD_MESSAGE user.visible_message("[user] begins welding [src] to [get_turf(src)]...", "You begin welding [src] to [get_turf(src)]...", "You hear welding.") +#define WELDER_FLOOR_WELD_SUCCESS_MESSAGE to_chat(user, "You weld [src] to [get_turf(src)]!") + +//Wrench messages +#define WRENCH_ANCHOR_MESSAGE user.visible_message("[user] tightens the bolts on [src]!", "You tighten the bolts on [src]!", "You hear ratcheting.") +#define WRENCH_UNANCHOR_MESSAGE user.visible_message("[user] loosens the bolts on [src]!", "You loosen the bolts on [src]!", "You hear ratcheting.") +#define WRENCH_UNANCHOR_WALL_MESSAGE user.visible_message("[user] unwrenches [src] from the wall!", "You unwrench [src] from the wall!", "You hear ratcheting.") +#define WRENCH_ANCHOR_TO_WALL_MESSAGE user.visible_message("[user] affixes [src] to the wall!", "You affix [src] to the wall!", "You hear ratcheting.") + +//Generic tool messages that don't correspond to any particular tool +#define TOOL_ATTEMPT_DISMANTLE_MESSAGE user.visible_message("[user] begins to disassemble [src] with [I]...", "You begin to disassemble [src] with [I]...", "You hear someone using some kind of tool.") +#define TOOL_DISMANTLE_SUCCESS_MESSAGE user.visible_message("[user] dismantles [src]!", "You dismantle [src]!", "You hear someone using some kind of tool.") diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 8c07fe175b2..7a91c3bf9bc 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -1,5 +1,5 @@ //location of the rust-g library -#define RUST_G "rust_g" +#define RUST_G (world.system_type == UNIX ? "./librust_g.so" : "./rust_g.dll") // On Linux/Unix systems the line endings are LF, on windows it's CRLF, admins that don't use notepad++ // will get logs that are one big line if the system is Linux and they are using notepad. This solves it by adding CR to every line ending diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 744b8b86a9a..0ab10447f8c 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -478,7 +478,10 @@ proc/pollCandidates(Question, be_special_type, antag_age_check = FALSE, poll_tim G << 'sound/misc/notice2.ogg'//Alerting them to their consideration if(flashwindow) window_flash(G.client) - switch(alert(G,Question,"Please answer in [poll_time/10] seconds!","No","Yes","Not This Round")) + var/ans = alert(G,Question,"Please answer in [poll_time/10] seconds!","No","Yes","Not This Round") + if(!G?.client) + return + switch(ans) if("Yes") to_chat(G, "Choice registered: Yes.") if((world.time-time_passed)>poll_time)//If more than 30 game seconds passed. diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index 0f356aa4f4a..db41b411d12 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -108,11 +108,10 @@ // Used to get a sanitized input. /proc/stripped_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN, no_trim=FALSE) - var/name = input(user, message, title, default) as text|null - if(no_trim) - return copytext(html_encode(name), 1, max_length) - else - return trim(html_encode(name), max_length) //trim is "outside" because html_encode can expand single symbols into multiple symbols (such as turning < into <) + var/name = html_encode(input(user, message, title, default) as text|null) + if(!no_trim) + name = trim(name) //trim is "outside" because html_encode can expand single symbols into multiple symbols (such as turning < into <) + return copytext(name, 1, max_length) // Uses client.typing to check if the popup should appear or not /proc/typing_input(mob/user, message = "", title = "", default = "") diff --git a/code/__HELPERS/tool_helpers.dm b/code/__HELPERS/tool_helpers.dm new file mode 100644 index 00000000000..15c8e60591e --- /dev/null +++ b/code/__HELPERS/tool_helpers.dm @@ -0,0 +1,51 @@ +//Quick type checks for some tools + +/proc/iswrench(O) + if(istype(O, /obj/item/wrench)) + return TRUE + return FALSE + +/proc/iswelder(O) + if(istype(O, /obj/item/weldingtool)) + return TRUE + return FALSE + +/proc/iswirecutter(O) + if(istype(O, /obj/item/wirecutters)) + return TRUE + return FALSE + +/proc/isscrewdriver(O) + if(istype(O, /obj/item/screwdriver)) + return TRUE + return FALSE + +/proc/ismultitool(O) + if(istype(O, /obj/item/multitool)) + return TRUE + return FALSE + +/proc/iscrowbar(O) + if(istype(O, /obj/item/crowbar)) + return TRUE + return FALSE + +/proc/iscoil(O) + if(istype(O, /obj/item/stack/cable_coil)) + return TRUE + return FALSE + +/proc/ispowertool(O)//used to check if a tool can force powered doors + if(istype(O, /obj/item/crowbar/power) || istype(O, /obj/item/mecha_parts/mecha_equipment/medical/rescue_jaw)) + return TRUE + return FALSE + +/proc/is_surgery_tool(obj/item/W as obj) + return ( \ + istype(W, /obj/item/scalpel) || \ + istype(W, /obj/item/hemostat) || \ + istype(W, /obj/item/retractor) || \ + istype(W, /obj/item/cautery) || \ + istype(W, /obj/item/bonegel) || \ + istype(W, /obj/item/bonesetter) + ) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index f1611b38fd9..45283498ebd 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1142,70 +1142,9 @@ var/list/can_embed_types = typecacheof(list( if(is_type_in_typecache(W, can_embed_types)) return 1 -//Quick type checks for some tools -var/global/list/common_tools = list( -/obj/item/stack/cable_coil, -/obj/item/wrench, -/obj/item/weldingtool, -/obj/item/screwdriver, -/obj/item/wirecutters, -/obj/item/multitool, -/obj/item/crowbar) - -/proc/istool(O) - if(O && is_type_in_list(O, common_tools)) - return 1 - return 0 - -/proc/iswrench(O) - if(istype(O, /obj/item/wrench)) - return 1 - return 0 - -/proc/iswelder(O) - if(istype(O, /obj/item/weldingtool)) - return 1 - return 0 - -/proc/iscoil(O) - if(istype(O, /obj/item/stack/cable_coil)) - return 1 - return 0 - -/proc/iswirecutter(O) - if(istype(O, /obj/item/wirecutters)) - return 1 - return 0 - -/proc/isscrewdriver(O) - if(istype(O, /obj/item/screwdriver)) - return 1 - return 0 - -/proc/ismultitool(O) - if(istype(O, /obj/item/multitool)) - return 1 - return 0 - -/proc/iscrowbar(O) - if(istype(O, /obj/item/crowbar)) - return 1 - return 0 - -/proc/ispowertool(O)//used to check if a tool can force powered doors - if(istype(O, /obj/item/crowbar/power) || istype(O, /obj/item/mecha_parts/mecha_equipment/medical/rescue_jaw)) - return TRUE - return FALSE - -/proc/iswire(O) - if(istype(O, /obj/item/stack/cable_coil)) - return 1 - return 0 - /proc/is_hot(obj/item/W as obj) - if(istype(W, /obj/item/weldingtool)) - var/obj/item/weldingtool/O = W - if(O.isOn()) + if(W.tool_behaviour == TOOL_WELDER) + if(W.tool_enabled) return 2500 else return 0 @@ -1260,16 +1199,6 @@ var/global/list/common_tools = list( return 1 return 0 -/proc/is_surgery_tool(obj/item/W as obj) - return ( \ - istype(W, /obj/item/scalpel) || \ - istype(W, /obj/item/hemostat) || \ - istype(W, /obj/item/retractor) || \ - istype(W, /obj/item/cautery) || \ - istype(W, /obj/item/bonegel) || \ - istype(W, /obj/item/bonesetter) - ) - /proc/reverse_direction(var/dir) switch(dir) if(NORTH) diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index 8d58245eda5..7c2214e2287 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -42,8 +42,8 @@ if(control_disabled || stat) return - - var/turf/pixel_turf = get_turf_pixel(A) + + var/turf/pixel_turf = isturf(A) ? A : get_turf_pixel(A) if(isnull(pixel_turf)) return if(!can_see(A)) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 47b5f2ba337..d2a91da4020 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -1,10 +1,17 @@ /obj/item/proc/melee_attack_chain(mob/user, atom/target, params) - if(pre_attackby(target, user, params)) + if(!tool_attack_chain(user, target) && pre_attackby(target, user, params)) // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) var/resolved = target.attackby(src, user, params) if(!resolved && target && !QDELETED(src)) afterattack(target, user, 1, params) // 1: clicking something Adjacent +//Checks if the item can work as a tool, calling the appropriate tool behavior on the target +//Note that if tool_act returns TRUE, then the tool won't call attack_by. +/obj/item/proc/tool_attack_chain(mob/user, atom/target) + if(!tool_behaviour) + return FALSE + return target.tool_act(user, src, tool_behaviour) + // Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown. /obj/item/proc/attack_self(mob/user) if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_SELF, user) & COMPONENT_NO_INTERACT) @@ -50,17 +57,12 @@ return 0 else return 1 - - if(isscrewdriver(src) && ismachine(M) && user.a_intent == INTENT_HELP) + var/obj/item/organ/external/O = M.get_organ(user.zone_selected) + if((is_sharp(src) || (isscrewdriver(src) && O.is_robotic())) && user.a_intent == INTENT_HELP) if(!attempt_initiate_surgery(src, M, user)) - return 0 + return FALSE else - return 1 - if(is_sharp(src) && user.a_intent == INTENT_HELP) - if(!attempt_initiate_surgery(src, M, user)) - return 0 - else - return 1 + return TRUE if(force && HAS_TRAIT(user, TRAIT_PACIFISM)) to_chat(user, "You don't want to harm other living beings!") diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 5f0c94ecee6..460bc0193f6 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -61,6 +61,8 @@ // health + cyborg analyzer for ghosts /mob/living/attack_ghost(mob/dead/observer/user) + if(!istype(user)) // Make sure user is actually an observer. Revenents also use attack_ghost, but do not have the health_scan var. + return if(user.client && user.health_scan) if(issilicon(src) || ismachine(src)) robot_healthscan(user, src) diff --git a/code/controllers/subsystem/idlenpcpool.dm b/code/controllers/subsystem/idlenpcpool.dm index 2dad0abca0f..3757237243f 100644 --- a/code/controllers/subsystem/idlenpcpool.dm +++ b/code/controllers/subsystem/idlenpcpool.dm @@ -29,6 +29,7 @@ SUBSYSTEM_DEF(idlenpcpool) var/mob/living/simple_animal/SA = currentrun[currentrun.len] --currentrun.len if(!SA) + log_debug("idlenpcpool encountered an invalid entry, resumed: [resumed], SA [SA], type of SA [SA?.type], null [SA == null], qdelled [QDELETED(SA)], SA in AI_IDLE list: [SA in GLOB.simple_animals[AI_IDLE]]") GLOB.simple_animals[AI_IDLE] -= SA continue diff --git a/code/controllers/subsystem/npcpool.dm b/code/controllers/subsystem/npcpool.dm index 0de306b12eb..f2e159404fd 100644 --- a/code/controllers/subsystem/npcpool.dm +++ b/code/controllers/subsystem/npcpool.dm @@ -21,6 +21,10 @@ SUBSYSTEM_DEF(npcpool) while(currentrun.len) var/mob/living/simple_animal/SA = currentrun[currentrun.len] --currentrun.len + if(!SA) + log_debug("npcpool encountered an invalid entry, resumed: [resumed], SA [SA], type of SA [SA?.type], null [SA == null], qdelled [QDELETED(SA)], SA in AI_ON list: [SA in GLOB.simple_animals[AI_ON]]") + GLOB.simple_animals[AI_ON] -= SA + continue if(!SA.ckey && !SA.notransform) if(SA.stat != DEAD) diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 27d499254a1..eca632b7b95 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -52,7 +52,7 @@ SUBSYSTEM_DEF(vote) voting.Cut() current_votes.Cut() - if(auto_muted && !config.ooc_allowed) + if(auto_muted && !config.ooc_allowed && !(config.auto_toggle_ooc_during_round && SSticker.current_state == GAME_STATE_PLAYING)) auto_muted = 0 config.ooc_allowed = !( config.ooc_allowed ) to_chat(world, "The OOC channel has been automatically enabled due to vote end.") diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index e5b948f4f26..aca505e6a03 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -41,6 +41,10 @@ use_delay = use_delay_override /datum/component/squeak/proc/play_squeak() + if(ismob(parent)) + var/mob/M = parent + if(M.stat == DEAD) + return if(prob(squeak_chance)) if(!override_squeak_sounds) playsound(parent, pickweight(default_squeak_sounds), volume, 1, -1) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index a41e58fa28c..daa50119135 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -548,7 +548,7 @@ to_chat(usr, "This can only be used on instances of type /mob") return - var/new_name = reject_bad_name(sanitize(copytext(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null,1,MAX_NAME_LEN))) + var/new_name = reject_bad_name(sanitize(copytext(input(usr, "What would you like to name this mob?", "Input a name", M.real_name) as text|null, 1, MAX_NAME_LEN)), allow_numbers = TRUE) if( !new_name || !M ) return message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].") diff --git a/code/datums/helper_datums/construction_datum.dm b/code/datums/helper_datums/construction_datum.dm index 8cc1bdc27d8..f73607a2a4e 100644 --- a/code/datums/helper_datums/construction_datum.dm +++ b/code/datums/helper_datums/construction_datum.dm @@ -1,5 +1,6 @@ #define FORWARD -1 #define BACKWARD 1 +#define CONSTRUCTION_TOOL_BEHAVIOURS list(TOOL_CROWBAR, TOOL_SCREWDRIVER, TOOL_WELDER, TOOL_WRENCH) /datum/construction var/list/steps @@ -38,30 +39,13 @@ /datum/construction/proc/is_right_key(atom/used_atom) // returns current step num if used_atom is of the right type. var/list/L = steps[steps.len] - if(istype(used_atom, L["key"])) + if(do_tool_or_atom_check(used_atom, L["key"])) return steps.len return 0 + /datum/construction/proc/custom_action(step, used_atom, user) - if(istype(used_atom, /obj/item/weldingtool)) - var/obj/item/weldingtool/W = used_atom - if(W.remove_fuel(0, user)) - playsound(holder, W.usesound, 50, 1) - else - return 0 - else if(istype(used_atom, /obj/item/wrench)) - var/obj/item/wrench/W = used_atom - playsound(holder, W.usesound, 50, 1) - - else if(istype(used_atom, /obj/item/screwdriver)) - var/obj/item/screwdriver/S = used_atom - playsound(holder, S.usesound, 50, 1) - - else if(istype(used_atom, /obj/item/wirecutters)) - var/obj/item/wirecutters/W = used_atom - playsound(holder, W.usesound, 50, 1) - - else if(istype(used_atom, /obj/item/stack/cable_coil)) + if(istype(used_atom, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = used_atom if(C.amount<4) to_chat(user, ("There's not enough cable to finish the task.")) @@ -76,18 +60,22 @@ return 0 else S.use(5) + else if(isitem(used_atom)) + var/obj/item/I = used_atom + if(I.tool_behaviour in CONSTRUCTION_TOOL_BEHAVIOURS) + if(!I.use_tool(holder, user, 0, volume = I.tool_volume)) + return 0 return 1 /datum/construction/proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one. for(var/i=1;i<=steps.len;i++) var/list/L = steps[i]; - if(istype(used_atom, L["key"])) - if(custom_action(i, used_atom, user)) - steps[i]=null;//stupid byond list from list removal... - listclearnulls(steps); - if(!steps.len) - spawn_result(user) - return 1 + if(do_tool_or_atom_check(used_atom, L["key"]) && custom_action(i, used_atom, user)) + steps[i]=null;//stupid byond list from list removal... + listclearnulls(steps); + if(!steps.len) + spawn_result(user) + return 1 return 0 @@ -116,15 +104,12 @@ if(!coil.use(amount)) to_chat(user, "You don't have enough cable! You need at least [amount] coils.") return 0 - // WELDER - if(istype(used_atom,/obj/item/weldingtool)) - var/obj/item/weldingtool/welder=used_atom - if(!welder.isOn()) - to_chat(user, "You tap the [src] with your unlit welder. [pick("Ding","Dong")].") - return 0 - if(!welder.remove_fuel(amount,user)) - to_chat(user, "You don't have enough fuel!") - return 0 + // TOOLS + if(isitem(used_atom)) + var/obj/item/I = used_atom + if(I.tool_behaviour in CONSTRUCTION_TOOL_BEHAVIOURS) + if(!I.use(amount)) + return 0 // STACKS if(istype(used_atom,/obj/item/stack)) var/obj/item/stack/stack=used_atom @@ -134,6 +119,14 @@ stack.use(amount) return 1 +/datum/construction/proc/do_tool_or_atom_check(used_atom, thing_to_check) //Checks if an atom is either a required thing; or if it's a required tool + if(istype(used_atom, thing_to_check)) + return TRUE + else if(isitem(used_atom)) + var/obj/item/I = used_atom + if(I.tool_behaviour == thing_to_check) + return TRUE + /datum/construction/reversible var/index @@ -152,9 +145,9 @@ /datum/construction/reversible/is_right_key(atom/used_atom) // returns index step var/list/L = steps[index] - if(istype(used_atom, L["key"])) + if(do_tool_or_atom_check(used_atom, L["key"])) return FORWARD //to the first step -> forward - else if(L["backkey"] && istype(used_atom, L["backkey"])) + else if(L["backkey"] && do_tool_or_atom_check(used_atom, L["backkey"])) return BACKWARD //to the last step -> backwards return 0 @@ -198,13 +191,13 @@ var/list/state = steps[index] if(state_next in state) var/list/step = state[state_next] - if(istype(used_atom, step["key"])) + if(do_tool_or_atom_check(used_atom, step["key"])) //if(L["consume"] && !try_consume(used_atom,L["consume"])) // return 0 return FORWARD //to the first step -> forward else if(state_prev in state) var/list/step = state[state_prev] - if(istype(used_atom, step["key"])) + if(do_tool_or_atom_check(used_atom, step["key"])) //if(L["consume"] && !try_consume(used_atom,L["consume"])) // return 0 return BACKWARD //to the first step -> forward diff --git a/code/datums/mind.dm b/code/datums/mind.dm index dd1a88b8b36..036d70fa17a 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -225,9 +225,7 @@ /datum/mind/proc/memory_edit_cult(mob/living/carbon/human/H) . = _memory_edit_header("cult") - if(ismindshielded(H)) - . += "NO|cultist" - else if(src in SSticker.mode.cult) + if(src in SSticker.mode.cult) . += "no|CULTIST" . += "
Give tome|equip." else diff --git a/code/datums/spells/summonitem.dm b/code/datums/spells/summonitem.dm index 8dbaf5afa77..aaef2229856 100644 --- a/code/datums/spells/summonitem.dm +++ b/code/datums/spells/summonitem.dm @@ -52,73 +52,71 @@ marked_item = null else //Getting previously marked item - var/obj/item_to_retrive = marked_item + var/obj/item_to_retrieve = marked_item var/infinite_recursion = 0 //I don't want to know how someone could put something inside itself but these are wizards so let's be safe - while(!isturf(item_to_retrive.loc) && infinite_recursion < 10) //if it's in something you get the whole thing. - if(ismob(item_to_retrive.loc)) //If its on someone, properly drop it - var/mob/M = item_to_retrive.loc + while(!isturf(item_to_retrieve.loc) && infinite_recursion < 10) //if it's in something you get the whole thing. + if(ismob(item_to_retrieve.loc)) //If its on someone, properly drop it + var/mob/M = item_to_retrieve.loc - if(issilicon(M)) //Items in silicons warp the whole silicon - M.loc.visible_message("[M] suddenly disappears!") - M.loc = target.loc + if(issilicon(M) || !M.unEquip(item_to_retrieve)) //Items in silicons warp the whole silicon + M.visible_message("[M] suddenly disappears!", "A force suddenly pulls you away!") + M.forceMove(target.loc) M.loc.visible_message("[M] suddenly appears!") - item_to_retrive = null + item_to_retrieve = null break - M.unEquip(item_to_retrive) - if(ishuman(M)) //Edge case housekeeping var/mob/living/carbon/human/C = M - /*if(C.internal_bodyparts_by_name && item_to_retrive in C.internal_bodyparts_by_name ) //This won't work, as we use organ datums instead of objects. --DZD - C.internal_bodyparts_by_name -= item_to_retrive + /*if(C.internal_bodyparts_by_name && item_to_retrieve in C.internal_bodyparts_by_name ) //This won't work, as we use organ datums instead of objects. --DZD + C.internal_bodyparts_by_name -= item_to_retrieve if(istype(marked_item, /obj/item/brain)) //If this code ever runs I will be happy var/obj/item/brain/B = new /obj/item/brain(target.loc) B.transfer_identity(C) C.death() add_attack_logs(target, C, "Magically debrained INTENT: [uppertext(target.a_intent)]")*/ - if(C.stomach_contents && item_to_retrive in C.stomach_contents) - C.stomach_contents -= item_to_retrive + if(C.stomach_contents && item_to_retrieve in C.stomach_contents) + C.stomach_contents -= item_to_retrieve for(var/X in C.bodyparts) var/obj/item/organ/external/part = X - if(item_to_retrive in part.embedded_objects) - part.embedded_objects -= item_to_retrive - to_chat(C, "The [item_to_retrive] that was embedded in your [part] has mysteriously vanished. How fortunate!") + if(item_to_retrieve in part.embedded_objects) + part.embedded_objects -= item_to_retrieve + to_chat(C, "The [item_to_retrieve] that was embedded in your [part] has mysteriously vanished. How fortunate!") if(!C.has_embedded_objects()) C.clear_alert("embeddedobject") break else - if(istype(item_to_retrive.loc,/obj/machinery/portable_atmospherics/)) //Edge cases for moved machinery - var/obj/machinery/portable_atmospherics/P = item_to_retrive.loc + if(istype(item_to_retrieve.loc,/obj/machinery/portable_atmospherics/)) //Edge cases for moved machinery + var/obj/machinery/portable_atmospherics/P = item_to_retrieve.loc P.disconnect() P.update_icon() - if(istype(item_to_retrive.loc, /obj/structure/disposalholder) || istype(item_to_retrive.loc, /obj/machinery/disposal))//fixes the breaking of disposals. No more bluespace connected disposal bins! + if(istype(item_to_retrieve.loc, /obj/structure/disposalholder) || istype(item_to_retrieve.loc, /obj/machinery/disposal))//fixes the breaking of disposals. No more bluespace connected disposal bins! break - item_to_retrive = item_to_retrive.loc + item_to_retrieve = item_to_retrieve.loc infinite_recursion += 1 - if(!item_to_retrive) + if(!item_to_retrieve) return - item_to_retrive.loc.visible_message("The [item_to_retrive.name] suddenly disappears!") + item_to_retrieve.loc.visible_message("The [item_to_retrieve.name] suddenly disappears!") if(target.hand) //left active hand - if(!target.equip_to_slot_if_possible(item_to_retrive, slot_l_hand, 0, 1, 1)) - if(!target.equip_to_slot_if_possible(item_to_retrive, slot_r_hand, 0, 1, 1)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_l_hand, 0, 1, 1)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_r_hand, 0, 1, 1)) butterfingers = 1 else //right active hand - if(!target.equip_to_slot_if_possible(item_to_retrive, slot_r_hand, 0, 1, 1)) - if(!target.equip_to_slot_if_possible(item_to_retrive, slot_l_hand, 0, 1, 1)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_r_hand, 0, 1, 1)) + if(!target.equip_to_slot_if_possible(item_to_retrieve, slot_l_hand, 0, 1, 1)) butterfingers = 1 if(butterfingers) - item_to_retrive.loc = target.loc - item_to_retrive.loc.visible_message("The [item_to_retrive.name] suddenly appears!") + item_to_retrieve.loc = target.loc + item_to_retrieve.loc.visible_message("The [item_to_retrieve.name] suddenly appears!") playsound(get_turf(target),'sound/magic/summonitems_generic.ogg',50,1) else - item_to_retrive.loc.visible_message("The [item_to_retrive.name] suddenly appears in [target]'s hand!") + item_to_retrieve.loc.visible_message("The [item_to_retrieve.name] suddenly appears in [target]'s hand!") playsound(get_turf(target),'sound/magic/summonitems_generic.ogg',50,1) if(message) diff --git a/code/datums/wires/alarm.dm b/code/datums/wires/alarm.dm index e29a40240c5..f6b49b0dd99 100644 --- a/code/datums/wires/alarm.dm +++ b/code/datums/wires/alarm.dm @@ -54,8 +54,7 @@ // to_chat(world, "Power wire cut") if(AALARM_WIRE_AI_CONTROL) - if(A.aidisabled == !mended) - A.aidisabled = mended + A.aidisabled = !mended // to_chat(world, "AI Control Wire Cut") if(AALARM_WIRE_SYPHON) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index d055310eddf..6a877ef90ea 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -5,12 +5,6 @@ #define MAX_FLAG 65535 -/proc/is_wire_tool(obj/item/I) - if(ismultitool(I)) - return TRUE - if(iswirecutter(I)) - return TRUE - var/list/same_wires = list() // 12 colours, if you're adding more than 12 wires then add more colours here var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", "gold", "gray", "cyan", "navy", "purple", "pink") diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 8a19fb14d9c..cd7e1e45015 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -332,6 +332,47 @@ if(reagents) reagents.temperature_reagents(exposed_temperature) +/atom/proc/tool_act(mob/living/user, obj/item/I, tool_type) + switch(tool_type) + if(TOOL_CROWBAR) + return crowbar_act(user, I) + if(TOOL_MULTITOOL) + return multitool_act(user, I) + if(TOOL_SCREWDRIVER) + return screwdriver_act(user, I) + if(TOOL_WRENCH) + return wrench_act(user, I) + if(TOOL_WIRECUTTER) + return wirecutter_act(user, I) + if(TOOL_WELDER) + return welder_act(user, I) + + +// Tool-specific behavior procs. To be overridden in subtypes. +/atom/proc/crowbar_act(mob/living/user, obj/item/I) + return + +/atom/proc/multitool_act(mob/living/user, obj/item/I) + return + +//Check if the multitool has an item in its data buffer +/atom/proc/multitool_check_buffer(user, silent = FALSE) + if(!silent) + to_chat(user, "[src] has no data buffer!") + return FALSE + +/atom/proc/screwdriver_act(mob/living/user, obj/item/I) + return + +/atom/proc/wrench_act(mob/living/user, obj/item/I) + return + +/atom/proc/wirecutter_act(mob/living/user, obj/item/I) + return + +/atom/proc/welder_act(mob/living/user, obj/item/I) + return + /atom/proc/emag_act() return diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index 32ab33fc983..de42b5b253f 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -205,21 +205,8 @@ user.stop_pulling() /obj/machinery/dna_scannernew/attackby(var/obj/item/item as obj, var/mob/user as mob, params) - if(istype(item, /obj/item/screwdriver)) - if(occupant) - to_chat(user, "The maintenance panel is locked.") - return - default_deconstruction_screwdriver(user, "[icon_state]_maintenance", "[initial(icon_state)]", item) - return if(exchange_parts(user, item)) return - - if(istype(item, /obj/item/crowbar)) - if(panel_open) - for(var/obj/I in contents) // in case there is something in the scanner - I.forceMove(src.loc) - default_deconstruction_crowbar(item) - return else if(istype(item, /obj/item/reagent_containers/glass)) if(beaker) to_chat(user, "A beaker is already loaded into the machine.") @@ -255,6 +242,18 @@ return return ..() +/obj/machinery/dna_scannernew/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I)) + for(var/obj/thing in contents) // in case there is something in the scanner + thing.forceMove(src.loc) + +/obj/machinery/dna_scannernew/screwdriver_act(mob/user, obj/item/I) + if(occupant) + to_chat(user, "The maintenance panel is locked.") + return TRUE + if(default_deconstruction_screwdriver(user, "[icon_state]_maintenance", "[initial(icon_state)]", I)) + return TRUE + /obj/machinery/dna_scannernew/relaymove(mob/user as mob) if(user.incapacitated()) return 0 //maybe they should be able to get out with cuffs, but whatever diff --git a/code/game/gamemodes/blob/overmind.dm b/code/game/gamemodes/blob/overmind.dm index 140ead3a947..74ed59d2469 100644 --- a/code/game/gamemodes/blob/overmind.dm +++ b/code/game/gamemodes/blob/overmind.dm @@ -48,13 +48,14 @@ update_health_hud() /mob/camera/blob/update_health_hud() - if(blob_core) + if(blob_core && hud_used) hud_used.blobhealthdisplay.maptext = "
[round(blob_core.obj_integrity)]
" /mob/camera/blob/proc/add_points(var/points) if(points != 0) blob_points = Clamp(blob_points + points, 0, max_blob_points) - hud_used.blobpwrdisplay.maptext = "
[round(src.blob_points)]
" + if(hud_used) + hud_used.blobpwrdisplay.maptext = "
[round(src.blob_points)]
" /mob/camera/blob/say(var/message) if(!message) diff --git a/code/game/gamemodes/changeling/powers/augmented_eyesight.dm b/code/game/gamemodes/changeling/powers/augmented_eyesight.dm index b0b77a456d5..4663fef8b97 100644 --- a/code/game/gamemodes/changeling/powers/augmented_eyesight.dm +++ b/code/game/gamemodes/changeling/powers/augmented_eyesight.dm @@ -40,7 +40,7 @@ name = "protective membranes" desc = "These variable transparency organic membranes will protect you from welders and flashes and heal your eye damage." icon_state = "ling_eyeshield" - eye_colour = null + eye_colour = "#000000" implant_overlay = null slot = "eye_ling" status = 0 @@ -61,7 +61,7 @@ name = "heat receptors" desc = "These heat receptors dramatically increases eyes light sensing ability." icon_state = "ling_thermal" - eye_colour = null + eye_colour = "#000000" implant_overlay = null slot = "eye_ling" status = 0 diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index 113487dc1dc..39e3c5b7d3f 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -182,7 +182,7 @@ var/global/list/all_cults = list() if(!istype(cult_mind)) return 0 var/datum/game_mode/cult/cult_mode = SSticker.mode - if(!(cult_mind in cult) && is_convertable_to_cult(cult_mind)) + if(!(cult_mind in cult)) cult += cult_mind cult_mind.current.faction |= "cult" var/datum/action/innate/cultcomm/C = new() diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index eb54b52c225..70e0e3258eb 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -244,6 +244,7 @@ anchored = 1 density = 1 atom_say_verb = "blares" + speed_process = TRUE // Disgusting fix. Please remove once #12952 is merged var/timing = 0 var/default_timer = 4500 var/detonation_timer diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 962da01b74d..c27b230b3b2 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -587,10 +587,8 @@ Congratulations! You are now trained for invasive xenobiology research!"} ..() make_syndie() -/obj/item/radio/headset/abductor/attackby(obj/item/I, mob/user, params) - if(isscrewdriver(I)) - return // Stops humans from disassembling abductor headsets. - return ..() +/obj/item/radio/headset/abductor/screwdriver_act() + return// Stops humans from disassembling abductor headsets. /obj/item/scalpel/alien name = "alien scalpel" @@ -683,15 +681,6 @@ Congratulations! You are now trained for invasive xenobiology research!"} density = TRUE /obj/structure/table_frame/abductor/attackby(obj/item/I, mob/user, params) - if(iswrench(I)) - to_chat(user, "You start disassembling [src]...") - playsound(loc, I.usesound, 50, 1) - if(do_after(user, 30*I.toolspeed, target = src)) - playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) - for(var/i = 1, i <= framestackamount, i++) - new framestack(get_turf(src)) - qdel(src) - return if(istype(I, /obj/item/stack/sheet/mineral/abductor)) var/obj/item/stack/sheet/P = I if(P.get_amount() < 1) diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm index 63905bc3390..e764f97a46a 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm @@ -41,15 +41,17 @@ return to_chat(user, "Picking up the swarmer may cause it to activate. You should be careful about this.") -/obj/effect/mob_spawn/swarmer/attackby(obj/item/I, mob/user, params) - if(isscrewdriver(I) && user.a_intent != INTENT_HARM) - user.visible_message("[usr.name] deactivates [src].", - "After some fiddling, you find a way to disable [src]'s power source.", - "You hear clicking.") - new /obj/item/deactivated_swarmer(get_turf(src)) - qdel(src) - else - return ..() +/obj/effect/mob_spawn/swarmer/screwdriver_act(mob/user, obj/item/I) + if(user.a_intent == INTENT_HARM) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + user.visible_message("[usr.name] deactivates [src].", + "After some fiddling, you find a way to disable [src]'s power source.", + "You hear clicking.") + new /obj/item/deactivated_swarmer(get_turf(src)) + qdel(src) ////The Mob itself//// diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index 1c4956d096e..714ccbf1d5f 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -1,3 +1,10 @@ +#define NUKE_INTACT 0 +#define NUKE_COVER_OFF 1 +#define NUKE_COVER_OPEN 2 +#define NUKE_SEALANT_OPEN 3 +#define NUKE_UNWRENCHED 4 +#define NUKE_MOBILE 5 + var/bomb_set /obj/machinery/nuclearbomb @@ -17,7 +24,7 @@ var/bomb_set var/yes_code = 0 var/safety = 1 var/obj/item/disk/nuclear/auth = null - var/removal_stage = 0 // 0 is no removal, 1 is covers removed, 2 is covers open, 3 is sealant open, 4 is unwrenched, 5 is removed from bolts. + var/removal_stage = NUKE_INTACT var/lastentered var/is_syndicate = 0 use_power = NO_POWER_USE @@ -50,33 +57,6 @@ var/bomb_set return /obj/machinery/nuclearbomb/attackby(obj/item/O as obj, mob/user as mob, params) - if(istype(O, /obj/item/screwdriver)) - add_fingerprint(user) - if(auth) - if(panel_open == 0) - panel_open = 1 - overlays += image(icon, "npanel_open") - to_chat(user, "You unscrew the control panel of [src].") - playsound(src, O.usesound, 50, 1) - else - panel_open = 0 - overlays -= image(icon, "npanel_open") - to_chat(user, "You screw the control panel of [src] back on.") - playsound(src, O.usesound, 50, 1) - else - if(panel_open == 0) - to_chat(user, "[src] emits a buzzing noise, the panel staying locked in.") - if(panel_open == 1) - panel_open = 0 - overlays -= image(icon, "npanel_open") - to_chat(user, "You screw the control panel of [src] back on.") - playsound(src, O.usesound, 50, 1) - flick("nuclearbombc", src) - return - - if(panel_open && (istype(O, /obj/item/multitool) || istype(O, /obj/item/wirecutters))) - return attack_hand(user) - if(istype(O, /obj/item/disk/nuclear)) if(extended) if(!user.drop_item()) @@ -89,77 +69,107 @@ var/bomb_set else to_chat(user, "You need to deploy \the [src] first. Right click on the sprite, select 'Make Deployable' then click on \the [src] with an empty hand.") return - - if(anchored) - switch(removal_stage) - if(0) - if(istype(O,/obj/item/weldingtool)) - var/obj/item/weldingtool/WT = O - if(!WT.isOn()) return - if(WT.get_fuel() < 5) // uses up 5 fuel. - to_chat(user, "You need more fuel to complete this task.") - return - - user.visible_message("[user] starts cutting loose the anchoring bolt covers on [src].", "You start cutting loose the anchoring bolt covers with [O]...") - - if(do_after(user,40, target = src)) - if(!src || !user || !WT.remove_fuel(5, user)) return - user.visible_message("[user] cuts through the bolt covers on [src].", "You cut through the bolt cover.") - removal_stage = 1 - return - - if(1) - if(istype(O,/obj/item/crowbar)) - user.visible_message("[user] starts forcing open the bolt covers on [src].", "You start forcing open the anchoring bolt covers with [O]...") - - if(do_after(user,15, target = src)) - if(!src || !user) return - user.visible_message("[user] forces open the bolt covers on [src].", "You force open the bolt covers.") - removal_stage = 2 - return - - if(2) - if(istype(O,/obj/item/weldingtool)) - - var/obj/item/weldingtool/WT = O - if(!WT.isOn()) return - if(WT.get_fuel() < 5) // uses up 5 fuel. - to_chat(user, "You need more fuel to complete this task.") - return - - user.visible_message("[user] starts cutting apart the anchoring system sealant on [src].", "You start cutting apart the anchoring system's sealant with [O]...") - - if(do_after(user,40, target = src)) - if(!src || !user || !WT.remove_fuel(5, user)) return - user.visible_message("[user] cuts apart the anchoring system sealant on [src].", "You cut apart the anchoring system's sealant.") - removal_stage = 3 - return - - if(3) - if(istype(O,/obj/item/wrench)) - - user.visible_message("[user] begins unwrenching the anchoring bolts on [src].", "You begin unwrenching the anchoring bolts...") - - if(do_after(user,50, target = src)) - if(!src || !user) return - user.visible_message("[user] unwrenches the anchoring bolts on [src].", "You unwrench the anchoring bolts.") - removal_stage = 4 - return - - if(4) - if(istype(O,/obj/item/crowbar)) - - user.visible_message("[user] begins lifting [src] off of the anchors.", "You begin lifting the device off the anchors...") - - if(do_after(user,80, target = src)) - if(!src || !user) return - user.visible_message("[user] crowbars [src] off of the anchors. It can now be moved.", "You jam the crowbar under the nuclear device and lift it off its anchors. You can now move it!") - anchored = 0 - removal_stage = 5 - return - return return ..() +/obj/machinery/nuclearbomb/crowbar_act(mob/user, obj/item/I) + if(!anchored) + return + if(removal_stage != NUKE_UNWRENCHED && removal_stage != NUKE_COVER_OFF) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + if(removal_stage == NUKE_COVER_OFF) + user.visible_message("[user] starts forcing open the bolt covers on [src].", "You start forcing open the anchoring bolt covers with [I]...") + if(!I.use_tool(src, user, 15, volume = I.tool_volume) || removal_stage != NUKE_COVER_OFF) + return + user.visible_message("[user] forces open the bolt covers on [src].", "You force open the bolt covers.") + removal_stage = NUKE_COVER_OPEN + else + user.visible_message("[user] begins lifting [src] off of the anchors.", "You begin lifting the device off the anchors...") + if(!I.use_tool(src, user, 80, volume = I.tool_volume) || removal_stage != NUKE_UNWRENCHED) + return + user.visible_message("[user] crowbars [src] off of the anchors. It can now be moved.", "You jam the crowbar under the nuclear device and lift it off its anchors. You can now move it!") + anchored = FALSE + removal_stage = NUKE_MOBILE + +/obj/machinery/nuclearbomb/wrench_act(mob/user, obj/item/I) + if(!anchored) + return + if(removal_stage != NUKE_SEALANT_OPEN) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + user.visible_message("[user] begins unwrenching the anchoring bolts on [src].", "You begin unwrenching the anchoring bolts...") + if(!I.use_tool(src, user, 50, volume = I.tool_volume) || removal_stage != NUKE_SEALANT_OPEN) + return + user.visible_message("[user] unwrenches the anchoring bolts on [src].", "You unwrench the anchoring bolts.") + removal_stage = NUKE_UNWRENCHED + +/obj/machinery/nuclearbomb/multitool_act(mob/user, obj/item/I) + if(!panel_open) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + attack_hand(user) + +/obj/machinery/nuclearbomb/screwdriver_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(auth) + if(!panel_open) + panel_open = TRUE + overlays += image(icon, "npanel_open") + to_chat(user, "You unscrew the control panel of [src].") + else + panel_open = FALSE + overlays -= image(icon, "npanel_open") + to_chat(user, "You screw the control panel of [src] back on.") + else + if(!panel_open) + to_chat(user, "[src] emits a buzzing noise, the panel staying locked in.") + if(panel_open == TRUE) + panel_open = FALSE + overlays -= image(icon, "npanel_open") + to_chat(user, "You screw the control panel of [src] back on.") + flick("nuclearbombc", src) + +/obj/machinery/nuclearbomb/wirecutter_act(mob/user, obj/item/I) + if(!panel_open) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + attack_hand(user) + +/obj/machinery/nuclearbomb/welder_act(mob/user, obj/item/I) + . = TRUE + if(removal_stage != NUKE_INTACT && removal_stage != NUKE_COVER_OPEN) + return + if(!I.tool_use_check(user, 0)) + return + if(removal_stage == NUKE_INTACT) + visible_message("[user] starts cutting loose the anchoring bolt covers on [src].",\ + "You start cutting loose the anchoring bolt covers with [I]...",\ + "You hear welding.") + if(!I.use_tool(src, user, 40, 5, volume = I.tool_volume) || removal_stage != NUKE_INTACT) + return + visible_message("[user] cuts through the bolt covers on [src].",\ + "You cut through the bolt cover.") + removal_stage = NUKE_COVER_OFF + else if(removal_stage == NUKE_COVER_OPEN) + visible_message("[user] starts cutting apart the anchoring system sealant on [src].",\ + "You start cutting apart the anchoring system's sealant with [I]...",\ + "You hear welding.") + if(!I.use_tool(src, user, 40, 5, volume = I.tool_volume) || removal_stage != NUKE_COVER_OPEN) + return + visible_message("[user] cuts apart the anchoring system sealant on [src].",\ + "You cut apart the anchoring system's sealant.") + removal_stage = NUKE_SEALANT_OPEN + /obj/machinery/nuclearbomb/attack_ghost(mob/user as mob) if(extended) attack_hand(user) @@ -171,7 +181,7 @@ var/bomb_set else ui_interact(user) else if(deployable) - if(removal_stage < 5) + if(removal_stage != NUKE_MOBILE) anchored = 1 visible_message("With a steely snap, bolts slide out of [src] and anchor it to the flooring!") else @@ -317,7 +327,7 @@ var/bomb_set timing = 0 bomb_set = 0 if(href_list["anchor"]) - if(removal_stage == 5) + if(removal_stage == NUKE_MOBILE) anchored = 0 visible_message("\The [src] makes a highly unpleasant crunching noise. It looks like the anchoring bolts have been cut.") SSnanoui.update_uis(src) @@ -453,3 +463,10 @@ var/bomb_set else error("[src] was supposed to be destroyed, but we were unable to locate a blobstart landmark to spawn a new one.") return QDEL_HINT_LETMELIVE // Cancel destruction unless forced. + +#undef NUKE_INTACT +#undef NUKE_COVER_OFF +#undef NUKE_COVER_OPEN +#undef NUKE_SEALANT_OPEN +#undef NUKE_UNWRENCHED +#undef NUKE_MOBILE diff --git a/code/game/gamemodes/wizard/soulstone.dm b/code/game/gamemodes/wizard/soulstone.dm index 2edbb41cb95..d97ec2af5fd 100644 --- a/code/game/gamemodes/wizard/soulstone.dm +++ b/code/game/gamemodes/wizard/soulstone.dm @@ -281,6 +281,9 @@ /proc/init_construct(mob/living/simple_animal/hostile/construct/C, mob/living/simple_animal/shade/SH, obj/item/soulstone/SS, obj/structure/constructshell/T) SH.mind.transfer_to(C) + if(iscultist(C)) + var/datum/action/innate/cultcomm/CC = new() + CC.Grant(C) //We have to grant the cult comms again because they're lost during the mind transfer. qdel(T) qdel(SH) to_chat(C, "You are still bound to serve your creator, follow their orders and help them complete their goals at all costs.") diff --git a/code/game/machinery/Freezer.dm b/code/game/machinery/Freezer.dm index 91afce20b4d..8f2625b8854 100644 --- a/code/game/machinery/Freezer.dm +++ b/code/game/machinery/Freezer.dm @@ -50,36 +50,39 @@ ..(dir,dir) /obj/machinery/atmospherics/unary/cold_sink/freezer/attackby(obj/item/I, mob/user, params) - if(default_deconstruction_screwdriver(user, "freezer-o", "freezer", I)) - on = 0 - update_icon() - return - if(exchange_parts(user, I)) return - - if(default_deconstruction_crowbar(I)) - return - - if(iswrench(I)) - if(!panel_open) - to_chat(user, "Open the maintenance panel first.") - return - var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH) - var/selected = input(user,"Select a direction for the connector.", "Connector Direction") in choices - dir = choices[selected] - playsound(src.loc, I.usesound, 50, 1) - var/node_connect = dir - initialize_directions = dir - for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) - if(target.initialize_directions & get_dir(target,src)) - node = target - break - build_network() - update_icon() - return return ..() +/obj/machinery/atmospherics/unary/cold_sink/freezer/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I)) + return TRUE + +/obj/machinery/atmospherics/unary/cold_sink/freezer/screwdriver_act(mob/user, obj/item/I) + if(default_deconstruction_screwdriver(user, "freezer-o", "freezer", I)) + on = FALSE + update_icon() + return TRUE + +/obj/machinery/atmospherics/unary/cold_sink/freezer/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(!panel_open) + to_chat(user, "Open the maintenance panel first.") + return + var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH) + var/selected = input(user,"Select a direction for the connector.", "Connector Direction") in choices + dir = choices[selected] + var/node_connect = dir + initialize_directions = dir + for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) + if(target.initialize_directions & get_dir(target,src)) + node = target + break + build_network() + update_icon() + /obj/machinery/atmospherics/unary/cold_sink/freezer/update_icon() if(panel_open) icon_state = "freezer-o" @@ -217,35 +220,38 @@ current_heat_capacity = 1000 * ((H - 1) ** 2) /obj/machinery/atmospherics/unary/heat_reservoir/heater/attackby(obj/item/I, mob/user, params) + if(exchange_parts(user, I)) + return + return ..() + +/obj/machinery/atmospherics/unary/heat_reservoir/heater/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I)) + return TRUE + +/obj/machinery/atmospherics/unary/heat_reservoir/heater/screwdriver_act(mob/user, obj/item/I) if(default_deconstruction_screwdriver(user, "heater-o", "heater", I)) on = 0 update_icon() - return + return TRUE - if(exchange_parts(user, I)) +/obj/machinery/atmospherics/unary/heat_reservoir/heater/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) return - - if(default_deconstruction_crowbar(I)) + if(!panel_open) + to_chat(user, "Open the maintenance panel first.") return - - if(iswrench(I)) - if(!panel_open) - to_chat(user, "Open the maintenance panel first.") - return - var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH) - var/selected = input(user,"Select a direction for the connector.", "Connector Direction") in choices - dir = choices[selected] - playsound(src.loc, I.usesound, 50, 1) - var/node_connect = dir - initialize_directions = dir - for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) - if(target.initialize_directions & get_dir(target,src)) - node = target - break - build_network() - update_icon() - return - return ..() + var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH) + var/selected = input(user,"Select a direction for the connector.", "Connector Direction") in choices + dir = choices[selected] + var/node_connect = dir + initialize_directions = dir + for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) + if(target.initialize_directions & get_dir(target,src)) + node = target + break + build_network() + update_icon() /obj/machinery/atmospherics/unary/heat_reservoir/heater/update_icon() if(panel_open) diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 2c6e60c3d52..8c93028649b 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -131,15 +131,18 @@ if(iscarbon(G.affecting)) take_victim(G.affecting, user) qdel(G) - if(iswrench(I)) - playsound(loc, I.usesound, 50, 1) - if(do_after(user, 20 * I.toolspeed, target = src)) - to_chat(user, "You deconstruct the table.") - new /obj/item/stack/sheet/plasteel(loc, 5) - qdel(src) else return ..() +/obj/machinery/optable/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.tool_start_check(user, 0)) + return + if(I.use_tool(src, user, 20, volume = I.tool_volume)) + to_chat(user, "You deconstruct the table.") + new /obj/item/stack/sheet/plasteel(loc, 5) + qdel(src) + /obj/machinery/optable/proc/check_table(mob/living/carbon/patient as mob) if(src.victim && get_turf(victim) == get_turf(src) && victim.lying) to_chat(usr, "The table is already occupied!") diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index 817d56cb47a..83778a99c26 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -75,27 +75,15 @@ P.forceMove(src) P.add_fingerprint(user) update_icon() - else if(iswelder(I) && user.a_intent != INTENT_HARM) - var/obj/item/weldingtool/WT = I - if(stat & BROKEN) - if(WT.remove_fuel(0,user)) - user.visible_message("[user] is repairing [src].", \ - "You begin repairing [src]...", \ - "You hear welding.") - playsound(loc, WT.usesound, 40, 1) - if(do_after(user,40*WT.toolspeed, 1, target = src)) - if(!WT.isOn() || !(stat & BROKEN)) - return - to_chat(user, "You repair [src].") - playsound(loc, 'sound/items/welder2.ogg', 50, 1) - stat &= ~BROKEN - obj_integrity = max_integrity - update_icon() - else - to_chat(user, "[src] does not need repairs.") else return ..() +/obj/machinery/pdapainter/welder_act(mob/user, obj/item/I) + . = TRUE + if(!I.tool_use_check(user, 0)) + return + default_welder_repair(user, I) + /obj/machinery/pdapainter/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) if(!(stat & BROKEN)) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index fbe594f2269..f1adf1a5f11 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -280,35 +280,9 @@ to_chat(user, "The sleeper has a beaker already.") return - if(isscrewdriver(I)) - if(occupant) - to_chat(user, "The maintenance panel is locked.") - return - default_deconstruction_screwdriver(user, "[base_icon]-o", "[base_icon]-open", I) - return - - if(iswrench(I)) - if(occupant) - to_chat(user, "The scanner is occupied.") - return - if(panel_open) - to_chat(user, "Close the maintenance panel first.") - return - if(dir == EAST) - orient = "LEFT" - setDir(WEST) - else - orient = "RIGHT" - setDir(EAST) - playsound(loc, I.usesound, 50, 1) - return - if(exchange_parts(user, I)) return - if(default_deconstruction_crowbar(I)) - return - if(istype(I, /obj/item/grab)) var/obj/item/grab/G = I if(panel_open) @@ -343,6 +317,34 @@ return ..() +/obj/machinery/sleeper/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I)) + return TRUE + +/obj/machinery/sleeper/screwdriver_act(mob/user, obj/item/I) + if(occupant) + to_chat(user, "The maintenance panel is locked.") + return TRUE + if(default_deconstruction_screwdriver(user, "[base_icon]-o", "[base_icon]-open", I)) + return TRUE + +/obj/machinery/sleeper/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(occupant) + to_chat(user, "The scanner is occupied.") + return + if(panel_open) + to_chat(user, "Close the maintenance panel first.") + return + if(dir == EAST) + orient = "LEFT" + setDir(WEST) + else + orient = "RIGHT" + setDir(EAST) + /obj/machinery/sleeper/ex_act(severity) if(filtering) toggle_filter() diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 0863b65415a..edb12487a68 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -40,33 +40,9 @@ RefreshParts() /obj/machinery/bodyscanner/attackby(obj/item/I, mob/user) - if(isscrewdriver(I)) - if(occupant) - to_chat(user, "The maintenance panel is locked.") - return - default_deconstruction_screwdriver(user, "bodyscanner-o", "bodyscanner-open", I) - return - - if(iswrench(I)) - if(occupant) - to_chat(user, "The scanner is occupied.") - return - if(panel_open) - to_chat(user, "Close the maintenance panel first.") - return - if(dir == EAST) - setDir(WEST) - else - setDir(EAST) - playsound(loc, I.usesound, 50, 1) - return - if(exchange_parts(user, I)) return - if(default_deconstruction_crowbar(I)) - return - if(istype(I, /obj/item/grab)) var/obj/item/grab/TYPECAST_YOUR_SHIT = I if(panel_open) @@ -93,6 +69,28 @@ return ..() +/obj/machinery/bodyscanner/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I)) + return TRUE + +/obj/machinery/bodyscanner/screwdriver_act(mob/user, obj/item/I) + if(default_deconstruction_screwdriver(user, "bodyscanner-o", "bodyscanner-open", I)) + return TRUE + +/obj/machinery/bodyscanner/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(occupant) + to_chat(user, "The scanner is occupied.") + return + if(panel_open) + to_chat(user, "Close the maintenance panel first.") + return + if(dir == EAST) + setDir(WEST) + else + setDir(EAST) /obj/machinery/bodyscanner/MouseDrop_T(mob/living/carbon/human/H, mob/user) if(!istype(H)) diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 2f6106a95a0..b7fdea3389e 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -62,6 +62,10 @@ #define MAX_TEMPERATURE 363.15 // 90C #define MIN_TEMPERATURE 233.15 // -40C +#define AIR_ALARM_FRAME 0 +#define AIR_ALARM_BUILDING 1 +#define AIR_ALARM_READY 2 + //all air alarms in area are connected via magic /area var/obj/machinery/alarm/master_air_alarm @@ -111,7 +115,7 @@ var/danger_level = ATMOS_ALARM_NONE var/alarmActivated = 0 // Manually activated (independent from danger level) - var/buildstage = 2 //2 is built, 1 is building, 0 is frame. + var/buildstage = AIR_ALARM_READY var/target_temperature = T20C var/regulating_temperature = 0 @@ -948,24 +952,6 @@ switch(buildstage) if(2) - if(isscrewdriver(I)) // Opening that Air Alarm up. - wiresexposed = !wiresexposed - to_chat(user, "The wires have been [wiresexposed ? "exposed" : "unexposed"]") - update_icon() - return - - if(iswirecutter(I)) // cutting the wires out - if(wires.wires_status == 31) // all wires cut - var/obj/item/stack/cable_coil/new_coil = new /obj/item/stack/cable_coil() - new_coil.amount = 5 - new_coil.forceMove(user.loc) - buildstage = 1 - update_icon() - return - - if(wiresexposed && ((ismultitool(I) || iswirecutter(I)))) - return attack_hand(user) - if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda))// trying to unlock the interface with an ID card if(stat & (NOPOWER|BROKEN)) to_chat(user, "It does nothing") @@ -980,7 +966,7 @@ return if(1) - if(istype(I, /obj/item/stack/cable_coil)) + if(iscoil(I)) var/obj/item/stack/cable_coil/coil = I if(coil.amount < 5) to_chat(user, "You need more cable for this!") @@ -996,19 +982,6 @@ update_icon() first_run() return - - else if(iscrowbar(I)) - to_chat(user, "You start prying out the circuit.") - playsound(get_turf(src), I.usesound, 50, 1) - if(do_after(user, 20 * I.toolspeed, target = src)) - if(buildstage != 1) - return - to_chat(user, "You pry out the circuit!") - var/obj/item/airalarm_electronics/circuit = new /obj/item/airalarm_electronics() - circuit.forceMove(user.loc) - buildstage = 0 - update_icon() - return if(0) if(istype(I, /obj/item/airalarm_electronics)) to_chat(user, "You insert the circuit!") @@ -1017,16 +990,70 @@ buildstage = 1 update_icon() return - - else if(iswrench(I)) - to_chat(user, "You remove the fire alarm assembly from the wall!") - new /obj/item/mounted/frame/alarm_frame(get_turf(user)) - playsound(get_turf(src), I.usesound, 50, 1) - qdel(src) - return - return ..() +/obj/machinery/alarm/crowbar_act(mob/user, obj/item/I) + if(buildstage != AIR_ALARM_BUILDING) + return + . = TRUE + if(!I.tool_start_check(user, 0)) + return + to_chat(user, "You start prying out the circuit.") + if(!I.use_tool(src, user, 20, volume = I.tool_volume)) + return + if(buildstage != AIR_ALARM_BUILDING) + return + to_chat(user, "You pry out the circuit!") + new /obj/item/airalarm_electronics(user.drop_location()) + buildstage = AIR_ALARM_FRAME + update_icon() + +/obj/machinery/alarm/multitool_act(mob/user, obj/item/I) + if(buildstage != AIR_ALARM_READY) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(wiresexposed) + attack_hand(user) + +/obj/machinery/alarm/screwdriver_act(mob/user, obj/item/I) + if(buildstage != AIR_ALARM_READY) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + wiresexposed = !wiresexposed + update_icon() + if(wiresexposed) + SCREWDRIVER_OPEN_PANEL_MESSAGE + else + SCREWDRIVER_CLOSE_PANEL_MESSAGE + +/obj/machinery/alarm/wirecutter_act(mob/user, obj/item/I) + if(buildstage != AIR_ALARM_READY) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(wires.wires_status == 31) // all wires cut + var/obj/item/stack/cable_coil/new_coil = new /obj/item/stack/cable_coil(user.drop_location()) + new_coil.amount = 5 + buildstage = AIR_ALARM_BUILDING + update_icon() + if(wiresexposed) + wires.Interact(user) + +/obj/machinery/alarm/wrench_act(mob/user, obj/item/I) + if(buildstage != AIR_ALARM_FRAME) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + new /obj/item/mounted/frame/alarm_frame(get_turf(user)) + WRENCH_UNANCHOR_WALL_MESSAGE + qdel(src) + /obj/machinery/alarm/power_change() if(powered(power_channel)) stat &= ~NOPOWER @@ -1076,3 +1103,8 @@ Just an object used in constructing air alarms origin_tech = "engineering=2;programming=1" toolspeed = 1 usesound = 'sound/items/deconstruct.ogg' + + +#undef AIR_ALARM_FRAME +#undef AIR_ALARM_BUILDING +#undef AIR_ALARM_READY diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 3210e899876..230401b673b 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -78,7 +78,6 @@ var/datum/canister_icons/canister_icon_container = new() use_power = NO_POWER_USE interact_offline = 1 var/release_log = "" - var/busy = 0 var/update_flag = 0 /obj/machinery/portable_atmospherics/canister/New() @@ -264,22 +263,6 @@ update_flag return canister_break() -/obj/machinery/portable_atmospherics/canister/attackby(obj/item/I, mob/user, params) - if(user.a_intent != INTENT_HARM && iswelder(I)) - var/obj/item/weldingtool/WT = I - if(stat & BROKEN) - if(!WT.remove_fuel(0, user)) - return - playsound(loc, WT.usesound, 40, 1) - to_chat(user, "You begin cutting [src] apart...") - if(do_after(user, 30, target = src)) - deconstruct(TRUE) - else - to_chat(user, "You cannot slice [src] apart when it isn't broken.") - return TRUE - else - return ..() - /obj/machinery/portable_atmospherics/canister/proc/canister_break() disconnect() var/datum/gas_mixture/expelled_gas = air_contents.remove(air_contents.total_moles()) @@ -610,21 +593,14 @@ update_flag src.update_icon() // Otherwise new canisters do not have their icon updated with the pressure light, likely want to add this to the canister class constructor, avoiding at current time to refrain from screwing up code for other canisters. --DZD return 1 -/obj/machinery/portable_atmospherics/canister/proc/weld(var/obj/item/weldingtool/WT, var/mob/user) - - if(busy) - return 0 - if(!WT.remove_fuel(0, user)) - return 0 - - // Do after stuff here - to_chat(user, "You start to slice away at \the [src]...") - playsound(src.loc, WT.usesound, 50, 1) - busy = 1 - if(do_after(user, 50 * WT.toolspeed, target = src)) - busy = 0 - if(!WT.isOn()) - return 0 - return 1 - busy = 0 - return 0 +/obj/machinery/portable_atmospherics/canister/welder_act(mob/user, obj/item/I) + if(!(stat & BROKEN)) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_SLICING_MESSAGE + if(I.use_tool(src, user, 50, volume = I.tool_volume)) + to_chat(user, "You salvage whats left of [src]!") + new /obj/item/stack/sheet/metal(drop_location(), 3) + qdel(src) diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm index b7c2dd152da..5008f4791ba 100644 --- a/code/game/machinery/atmoalter/portable_atmospherics.dm +++ b/code/game/machinery/atmoalter/portable_atmospherics.dm @@ -126,30 +126,32 @@ src.holding = T update_icon() return - else if(istype(W, /obj/item/wrench)) - if(connected_port) - disconnect() - to_chat(user, "You disconnect [name] from the port.") - update_icon() - return - else - var/obj/machinery/atmospherics/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/unary/portables_connector/) in loc - if(possible_port) - if(connect(possible_port)) - to_chat(user, "You connect [name] to the port.") - update_icon() - return - else - to_chat(user, "[name] failed to connect to the port.") - return - else - to_chat(user, "Nothing happens.") - return if((istype(W, /obj/item/analyzer)) && get_dist(user, src) <= 1) atmosanalyzer_scan(air_contents, user) return return ..() +/obj/machinery/portable_atmospherics/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(connected_port) + disconnect() + to_chat(user, "You disconnect [name] from the port.") + update_icon() + else + var/obj/machinery/atmospherics/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/unary/portables_connector/) in loc + if(possible_port) + if(connect(possible_port)) + to_chat(user, "You connect [src] to the port.") + update_icon() + return + else + to_chat(user, "[src] failed to connect to the port.") + return + else + to_chat(user, "Nothing happens.") + /obj/machinery/portable_atmospherics/attacked_by(obj/item/I, mob/user) if(I.force < 10 && !(stat & BROKEN)) take_damage(0) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index ae0611e69d4..52ee48f067b 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -174,21 +174,8 @@ if(busy) to_chat(user, "The autolathe is busy. Please wait for completion of previous operation.") return 1 - - if(default_deconstruction_screwdriver(user, "autolathe_t", "autolathe", O)) - SSnanoui.update_uis(src) - return - if(exchange_parts(user, O)) return - - if(panel_open) - if(istype(O, /obj/item/crowbar)) - default_deconstruction_crowbar(O) - return 1 - else - attack_hand(user) - return 1 if(stat) return 1 @@ -215,6 +202,50 @@ return ..() +/obj/machinery/autolathe/crowbar_act(mob/user, obj/item/I) + if(!I.use_tool(src, user, 0, volume = 0)) + return + . = TRUE + if(busy) + to_chat(user, "The autolathe is busy. Please wait for completion of previous operation.") + return + if(panel_open) + default_deconstruction_crowbar(user, I) + I.play_tool_sound(user, I.tool_volume) + +/obj/machinery/autolathe/screwdriver_act(mob/user, obj/item/I) + if(!I.use_tool(src, user, 0, volume = 0)) + return + . = TRUE + if(busy) + to_chat(user, "The autolathe is busy. Please wait for completion of previous operation.") + return + if(default_deconstruction_screwdriver(user, "autolathe_t", "autolathe", I)) + SSnanoui.update_uis(src) + I.play_tool_sound(user, I.tool_volume) + +/obj/machinery/autolathe/wirecutter_act(mob/user, obj/item/I) + if(!panel_open) + return + if(!I.use_tool(src, user, 0, volume = 0)) + return + . = TRUE + if(busy) + to_chat(user, "The autolathe is busy. Please wait for completion of previous operation.") + return + interact(user) + +/obj/machinery/autolathe/multitool_act(mob/user, obj/item/I) + if(!panel_open) + return + if(!I.use_tool(src, user, 0, volume = 0)) + return + . = TRUE + if(busy) + to_chat(user, "The autolathe is busy. Please wait for completion of previous operation.") + return + interact(user) + /obj/machinery/autolathe/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted) switch(id_inserted) if(MAT_METAL) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 7e0508ba24f..bb09c247bca 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -127,27 +127,7 @@ var/msg = "You attach [I] into the assembly inner circuits." var/msg2 = "The camera already has that upgrade!" - // DECONSTRUCTION - if(isscrewdriver(I)) - panel_open = !panel_open - to_chat(user, "You screw the camera's panel [panel_open ? "open" : "closed"].") - playsound(loc, I.usesound, 50, 1) - - else if((iswirecutter(I) || ismultitool(I)) && panel_open) - wires.Interact(user) - - else if(iswelder(I) && panel_open && wires.CanDeconstruct()) - var/obj/item/weldingtool/WT = I - if(!WT.remove_fuel(0, user)) - return - to_chat(user, "You start to weld [src]...") - playsound(loc, WT.usesound, 50, 1) - if(do_after(user, 100 * WT.toolspeed, target = src)) - user.visible_message("[user] unwelds [src], leaving it as just a frame bolted to the wall.", - "You unweld [src], leaving it as just a frame bolted to the wall") - deconstruct(TRUE) - - else if(istype(I, /obj/item/analyzer) && panel_open) //XRay + if(istype(I, /obj/item/analyzer) && panel_open) //XRay if(!user.drop_item()) to_chat(user, "[I] is stuck to your hand!") return @@ -233,6 +213,40 @@ else return ..() + +/obj/machinery/camera/screwdriver_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + panel_open = !panel_open + to_chat(user, "You screw [src]'s panel [panel_open ? "open" : "closed"].") + +/obj/machinery/camera/wirecutter_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = 0)) + return + if(panel_open) + wires.Interact(user) + +/obj/machinery/camera/multitool_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = 0)) + return + if(panel_open) + wires.Interact(user) + +/obj/machinery/camera/welder_act(mob/user, obj/item/I) + if(!panel_open || !wires.CanDeconstruct()) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_WELD_MESSAGE + if(I.use_tool(src, user, 100, volume = I.tool_volume)) + visible_message("[user] unwelds [src], leaving it as just a frame bolted to the wall.", + "You unweld [src], leaving it as just a frame bolted to the wall") + deconstruct(TRUE) + /obj/machinery/camera/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) if(stat & BROKEN) return damage_amount diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index 34915f2d01b..bd795ab340b 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -3,6 +3,7 @@ #define ASSEMBLY_WELDED 2 // Welded in place #define ASSEMBLY_WIRED 3 // Wires attached (Upgradable now) #define ASSEMBLY_BUILT 4 // Fully built (incl panel closed) +#define HEY_IM_WORKING_HERE 666 //So nobody can mess with the camera while we're inputting settings /obj/item/camera_assembly name = "camera assembly" @@ -16,7 +17,6 @@ var/list/obj/item/possible_upgrades = list(/obj/item/assembly/prox_sensor, /obj/item/stack/sheet/mineral/plasma, /obj/item/analyzer) var/list/upgrades = list() var/state = ASSEMBLY_UNBUILT - var/busy = FALSE /obj/item/camera_assembly/Destroy() @@ -24,106 +24,18 @@ return ..() /obj/item/camera_assembly/attackby(obj/item/I, mob/living/user, params) - - switch(state) - if(ASSEMBLY_UNBUILT) - // State 0 - if(iswrench(I) && isturf(loc)) - playsound(loc, I.usesound, 50, 1) - to_chat(user, "You wrench the assembly into place.") - anchored = 1 - state = ASSEMBLY_WRENCHED - update_icon() - auto_turn() - return - - if(ASSEMBLY_WRENCHED) - // State 1 - if(iswelder(I)) - if(weld(I, user)) - to_chat(user, "You weld the assembly securely into place.") - anchored = TRUE - state = ASSEMBLY_WELDED - return - - else if(iswrench(I)) - playsound(loc, I.usesound, 50, 1) - to_chat(user, "You unattach the assembly from it's place.") - anchored = FALSE - update_icon() - state = ASSEMBLY_UNBUILT - return - - if(ASSEMBLY_WELDED) - if(iscoil(I)) - var/obj/item/stack/cable_coil/C = I - if(C.use(2)) - to_chat(user, "You add wires to the assembly.") - playsound(loc, I.usesound, 50, 1) - state = ASSEMBLY_WIRED - else - to_chat(user, "You need 2 coils of wire to wire the assembly.") - return - - else if(iswelder(I)) - if(weld(I, user)) - to_chat(user, "You unweld the assembly from it's place.") - state = ASSEMBLY_WRENCHED - anchored = TRUE - return - - - if(ASSEMBLY_WIRED) - if(isscrewdriver(I)) - playsound(loc, I.usesound, 50, 1) - - var/input = strip_html(input(usr, "Which networks would you like to connect this camera to? Seperate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13")) - if(!input) - to_chat(usr, "No input found please hang up and try your call again.") - return - - var/list/tempnetwork = splittext(input, ",") - if(tempnetwork.len < 1) - to_chat(usr, "No network found please hang up and try your call again.") - return - - var/area/camera_area = get_area(src) - var/temptag = "[sanitize(camera_area.name)] ([rand(1, 999)])" - input = strip_html(input(usr, "How would you like to name the camera?", "Set Camera Name", temptag)) - - state = ASSEMBLY_BUILT - var/obj/machinery/camera/C = new(loc) - loc = C - C.assembly = src - - C.auto_turn() - - C.network = uniquelist(tempnetwork) - tempnetwork = difflist(C.network,GLOB.restricted_camera_networks) - if(!tempnetwork.len) // Camera isn't on any open network - remove its chunk from AI visibility. - cameranet.removeCamera(C) - - C.c_tag = input - - for(var/i = 5; i >= 0; i -= 1) - var/direct = input(user, "Direction?", "Assembling Camera", null) in list("LEAVE IT", "NORTH", "EAST", "SOUTH", "WEST" ) - if(direct != "LEAVE IT") - C.dir = text2dir(direct) - if(i != 0) - var/confirm = alert(user, "Is this what you want? Chances Remaining: [i]", "Confirmation", "Yes", "No") - if(confirm == "Yes") - break - return - - else if(iswirecutter(I)) - new/obj/item/stack/cable_coil(get_turf(src), 2) - playsound(loc, I.usesound, 50, 1) - to_chat(user, "You cut the wires from the circuits.") - state = ASSEMBLY_WELDED - return + if(state == ASSEMBLY_WELDED && iscoil(I)) + var/obj/item/stack/cable_coil/C = I + if(C.use(2)) + to_chat(user, "You add wires to the assembly.") + playsound(loc, I.usesound, 50, 1) + state = ASSEMBLY_WIRED + else + to_chat(user, "You need 2 coils of wire to wire the assembly.") + return // Upgrades! - if(is_type_in_list(I, possible_upgrades) && !is_type_in_list(I, upgrades)) // Is a possible upgrade and isn't in the camera already. + else if(is_type_in_list(I, possible_upgrades) && !is_type_in_list(I, upgrades)) // Is a possible upgrade and isn't in the camera already. if(!user.unEquip(I)) to_chat(user, "[I] is stuck!") return @@ -132,20 +44,117 @@ user.drop_item() I.loc = src return - - // Taking out upgrades - else if(iscrowbar(I) && upgrades.len) - var/obj/U = locate(/obj) in upgrades - if(U) - to_chat(user, "You unattach an upgrade from the assembly.") - playsound(loc, I.usesound, 50, 1) - U.loc = get_turf(src) - upgrades -= U - return - else return ..() +/obj/item/camera_assembly/crowbar_act(mob/user, obj/item/I) + if(!upgrades.len) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + var/obj/U = locate(/obj) in upgrades + if(U) + to_chat(user, "You unattach an upgrade from the assembly.") + playsound(loc, I.usesound, 50, 1) + U.loc = get_turf(src) + upgrades -= U + +/obj/item/camera_assembly/screwdriver_act(mob/user, obj/item/I) + if(state != ASSEMBLY_WIRED) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + state = HEY_IM_WORKING_HERE + var/input = strip_html(input(usr, "Which networks would you like to connect this camera to? Seperate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13")) + if(!input) + state = ASSEMBLY_WIRED + to_chat(usr, "No input found please hang up and try your call again.") + return + + var/list/tempnetwork = splittext(input, ",") + if(tempnetwork.len < 1) + state = ASSEMBLY_WIRED + to_chat(usr, "No network found please hang up and try your call again.") + return + + var/area/camera_area = get_area(src) + var/temptag = "[sanitize(camera_area.name)] ([rand(1, 999)])" + input = strip_html(input(usr, "How would you like to name the camera?", "Set Camera Name", temptag)) + state = ASSEMBLY_BUILT + var/obj/machinery/camera/C = new(loc) + loc = C + C.assembly = src + + C.auto_turn() + + C.network = uniquelist(tempnetwork) + tempnetwork = difflist(C.network,GLOB.restricted_camera_networks) + if(!tempnetwork.len) // Camera isn't on any open network - remove its chunk from AI visibility. + cameranet.removeCamera(C) + + C.c_tag = input + + for(var/i = 5; i >= 0; i -= 1) + var/direct = input(user, "Direction?", "Assembling Camera", null) in list("LEAVE IT", "NORTH", "EAST", "SOUTH", "WEST" ) + if(direct != "LEAVE IT") + C.dir = text2dir(direct) + if(i != 0) + var/confirm = alert(user, "Is this what you want? Chances Remaining: [i]", "Confirmation", "Yes", "No") + if(confirm == "Yes") + break + + +/obj/item/camera_assembly/wirecutter_act(mob/user, obj/item/I) + if(state != ASSEMBLY_WIRED) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + new/obj/item/stack/cable_coil(get_turf(src), 2) + WIRECUTTER_SNIP_MESSAGE + state = ASSEMBLY_WELDED + return + +/obj/item/camera_assembly/wrench_act(mob/user, obj/item/I) + if(state != ASSEMBLY_UNBUILT && state != ASSEMBLY_WRENCHED) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(state == ASSEMBLY_UNBUILT && isturf(loc)) + WRENCH_ANCHOR_TO_WALL_MESSAGE + anchored = TRUE + state = ASSEMBLY_WRENCHED + update_icon() + auto_turn() + else if(state == ASSEMBLY_WRENCHED) + WRENCH_UNANCHOR_WALL_MESSAGE + anchored = FALSE + update_icon() + state = ASSEMBLY_UNBUILT + else + to_chat(user, "[src] can't fit here!") + +/obj/item/camera_assembly/welder_act(mob/user, obj/item/I) + if(state == ASSEMBLY_UNBUILT) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_WELD_MESSAGE + if(state == ASSEMBLY_WRENCHED) + if(!I.use_tool(src, user, 50, volume = I.tool_volume)) + return + to_chat(user, "You weld [src] into place.") + state = ASSEMBLY_WELDED + else if(state == ASSEMBLY_WELDED) + if(!I.use_tool(src, user, 50, volume = I.tool_volume)) + return + to_chat(user, "You unweld [src] from its place.") + state = ASSEMBLY_WRENCHED + /obj/item/camera_assembly/update_icon() if(anchored) icon_state = "camera1" @@ -156,23 +165,6 @@ if(!anchored) ..() -/obj/item/camera_assembly/proc/weld(obj/item/weldingtool/WT, mob/living/user) - if(busy) - return FALSE - if(!WT.remove_fuel(0, user)) - return FALSE - - to_chat(user, "You start to weld the [src]...") - playsound(loc, WT.usesound, 50, 1) - busy = TRUE - if(do_after(user, 20 * WT.toolspeed, target = src)) - busy = FALSE - if(!WT.isOn()) - return FALSE - return TRUE - busy = FALSE - return FALSE - /obj/item/camera_assembly/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) new /obj/item/stack/sheet/metal(loc) @@ -184,3 +176,4 @@ #undef ASSEMBLY_WELDED #undef ASSEMBLY_WIRED #undef ASSEMBLY_BUILT +#undef HEY_IM_WORKING_HERE diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index e6c957c1779..fb87d91e3f0 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -68,17 +68,22 @@ user.visible_message("[user] inserts a cell into the charger.", "You insert a cell into the charger.") chargelevel = -1 updateicon() - else if(iswrench(I)) - if(charging) - to_chat(user, "Remove the cell first!") - return - - anchored = !anchored - to_chat(user, "You [anchored ? "attach" : "detach"] the cell charger [anchored ? "to" : "from"] the ground") - playsound(src.loc, I.usesound, 75, 1) else return ..() +/obj/machinery/cell_charger/wrench_act(mob/user, obj/item/I) + . = TRUE + if(charging) + to_chat(user, "Remove the cell first!") + return + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + anchored = !anchored + if(anchored) + WRENCH_ANCHOR_MESSAGE + else + WRENCH_UNANCHOR_MESSAGE + /obj/machinery/cell_charger/proc/removecell() charging.update_icon() diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 71ddcde9251..2b2f98368d8 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -363,16 +363,9 @@ //Let's unlock this early I guess. Might be too early, needs tweaking. /obj/machinery/clonepod/attackby(obj/item/I, mob/user, params) - if(!(occupant || mess)) - if(default_deconstruction_screwdriver(user, "[icon_state]_maintenance", "[initial(icon_state)]", I)) - return - if(exchange_parts(user, I)) return - if(default_deconstruction_crowbar(I)) - return - if(I.GetID()) if(!check_access(I)) to_chat(user, "Access Denied.") @@ -392,29 +385,42 @@ to_chat(user, "[src] processes [I].") biomass += BIOMASS_MEAT_AMOUNT qdel(I) - else if(iswrench(I)) - if(occupant) - to_chat(user, "Can not do that while [src] is in use.") - else - if(anchored) - anchored = FALSE - connected.pods -= src - connected = null - else - anchored = TRUE - playsound(loc, I.usesound, 100, 1) - if(anchored) - user.visible_message("[user] secures [src] to the floor.", "You secure [src] to the floor.") - else - user.visible_message("[user] unsecures [src] from the floor.", "You unsecure [src] from the floor.") - else if(ismultitool(I)) - var/obj/item/multitool/M = I - M.buffer = src - to_chat(user, "You load connection data from [src] to [M].") - return else return ..() +/obj/machinery/clonepod/crowbar_act(mob/user, obj/item/I) + . = TRUE + default_deconstruction_crowbar(user, I) + +/obj/machinery/clonepod/multitool_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(!I.multitool_check_buffer(user)) + return + var/obj/item/multitool/M = I + M.set_multitool_buffer(user, src) + +/obj/machinery/clonepod/screwdriver_act(mob/user, obj/item/I) + . = TRUE + default_deconstruction_screwdriver(user, "[icon_state]_maintenance", "[initial(icon_state)]", I) + +/obj/machinery/clonepod/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(occupant) + to_chat(user, "Can not do that while [src] is in use.") + return + if(anchored) + WRENCH_UNANCHOR_MESSAGE + anchored = FALSE + connected.pods -= src + connected = null + else + WRENCH_ANCHOR_MESSAGE + anchored = TRUE + /obj/machinery/clonepod/emag_act(user) if(isnull(occupant)) return diff --git a/code/game/machinery/computer/ai_core.dm b/code/game/machinery/computer/ai_core.dm index dfac3250d44..8d27ac5e7fa 100644 --- a/code/game/machinery/computer/ai_core.dm +++ b/code/game/machinery/computer/ai_core.dm @@ -17,197 +17,185 @@ return ..() /obj/structure/AIcore/attackby(obj/item/P, mob/user, params) - if(istype(P, /obj/item/wrench)) - return default_unfasten_wrench(user, P, 20) - if(!anchored) - if(iswelder(P)) - if(state != EMPTY_CORE) - to_chat(user, "The core must be empty to deconstruct it!") + switch(state) + if(EMPTY_CORE) + if(istype(P, /obj/item/circuitboard/aicore)) + if(!user.drop_item()) + return + playsound(loc, P.usesound, 50, 1) + to_chat(user, "You place the circuit board inside the frame.") + update_icon() + state = CIRCUIT_CORE + P.forceMove(src) + circuit = P return - var/obj/item/weldingtool/WT = P - if(!WT.isOn()) - to_chat(user, "The welder must be on for this task!") - return - playsound(loc, WT.usesound, 50, 1) - to_chat(user, "You start to deconstruct the frame...") - if(do_after(user, 20*P.toolspeed, target = src) && src && state == EMPTY_CORE && WT && WT.remove_fuel(0, user)) - to_chat(user, "You deconstruct the frame.") - deconstruct(TRUE) - return - else - switch(state) - if(EMPTY_CORE) - if(istype(P, /obj/item/circuitboard/aicore)) - if(!user.drop_item()) - return - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You place the circuit board inside the frame.") - update_icon() - state = CIRCUIT_CORE - P.forceMove(src) - circuit = P - return - if(CIRCUIT_CORE) - if(isscrewdriver(P)) - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You screw the circuit board into place.") - state = SCREWED_CORE - update_icon() - return - if(iscrowbar(P)) - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You remove the circuit board.") - state = EMPTY_CORE - update_icon() - circuit.forceMove(loc) - circuit = null - return - if(SCREWED_CORE) - if(iswirecutter(P) && circuit) - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You unfasten the circuit board.") - state = CIRCUIT_CORE - update_icon() - return - if(istype(P, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/C = P - if(C.get_amount() >= 5) - playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) - to_chat(user, "You start to add cables to the frame...") - if(do_after(user, 20, target = src) && state == SCREWED_CORE && C.use(5)) - to_chat(user, "You add cables to the frame.") - state = CABLED_CORE - update_icon() - else - to_chat(user, "You need five lengths of cable to wire the AI core!") - return - if(CABLED_CORE) - if(iswirecutter(P)) - if(brain) - to_chat(user, "Get that [brain.name] out of there first!") - else - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You remove the cables.") - state = SCREWED_CORE + if(SCREWED_CORE) + if(istype(P, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/C = P + if(C.get_amount() >= 5) + playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) + to_chat(user, "You start to add cables to the frame...") + if(do_after(user, 20, target = src) && state == SCREWED_CORE && C.use(5)) + to_chat(user, "You add cables to the frame.") + state = CABLED_CORE update_icon() - var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( loc ) - A.amount = 5 + else + to_chat(user, "You need five lengths of cable to wire the AI core!") + return + if(CABLED_CORE) + if(istype(P, /obj/item/stack/sheet/rglass)) + var/obj/item/stack/sheet/rglass/G = P + if(G.get_amount() >= 2) + playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) + to_chat(user, "You start to put in the glass panel...") + if(do_after(user, 20, target = src) && state == CABLED_CORE && G.use(2)) + to_chat(user, "You put in the glass panel.") + state = GLASS_CORE + update_icon() + else + to_chat(user, "You need two sheets of reinforced glass to insert them into the AI core!") + return + + if(istype(P, /obj/item/aiModule/purge)) + laws.clear_inherent_laws() + to_chat(usr, "Law module applied.") + return + + if(istype(P, /obj/item/aiModule/freeform)) + var/obj/item/aiModule/freeform/M = P + laws.add_inherent_law(M.newFreeFormLaw) + to_chat(usr, "Added a freeform law.") + return + + if(istype(P, /obj/item/aiModule)) + var/obj/item/aiModule/M = P + if(!M.laws) + to_chat(usr, "This AI module can not be applied directly to AI cores.") + return + laws = M.laws + + if(istype(P, /obj/item/mmi) && !brain) + var/obj/item/mmi/M = P + if(!M.brainmob) + to_chat(user, "Sticking an empty [P] into the frame would sort of defeat the purpose.") + return + if(M.brainmob.stat == DEAD) + to_chat(user, "Sticking a dead [P] into the frame would sort of defeat the purpose.") return - if(istype(P, /obj/item/stack/sheet/rglass)) - var/obj/item/stack/sheet/rglass/G = P - if(G.get_amount() >= 2) - playsound(loc, 'sound/items/deconstruct.ogg', 50, 1) - to_chat(user, "You start to put in the glass panel...") - if(do_after(user, 20, target = src) && state == CABLED_CORE && G.use(2)) - to_chat(user, "You put in the glass panel.") - state = GLASS_CORE - update_icon() - else - to_chat(user, "You need two sheets of reinforced glass to insert them into the AI core!") + if(!M.brainmob.client) + to_chat(user, "Sticking an inactive [M.name] into the frame would sort of defeat the purpose.") return - if(istype(P, /obj/item/aiModule/purge)) - laws.clear_inherent_laws() - to_chat(usr, "Law module applied.") + if(jobban_isbanned(M.brainmob, "AI") || jobban_isbanned(M.brainmob, "nonhumandept")) + to_chat(user, "This [P] does not seem to fit.") return - if(istype(P, /obj/item/aiModule/freeform)) - var/obj/item/aiModule/freeform/M = P - laws.add_inherent_law(M.newFreeFormLaw) - to_chat(usr, "Added a freeform law.") + if(!M.brainmob.mind) + to_chat(user, "This [M.name] is mindless!") return - if(istype(P, /obj/item/aiModule)) - var/obj/item/aiModule/M = P - if(!M.laws) - to_chat(usr, "This AI module can not be applied directly to AI cores.") - return - laws = M.laws - - if(istype(P, /obj/item/mmi) && !brain) - var/obj/item/mmi/M = P - if(!M.brainmob) - to_chat(user, "Sticking an empty [P] into the frame would sort of defeat the purpose.") - return - if(M.brainmob.stat == DEAD) - to_chat(user, "Sticking a dead [P] into the frame would sort of defeat the purpose.") - return - - if(!M.brainmob.client) - to_chat(user, "Sticking an inactive [M.name] into the frame would sort of defeat the purpose.") - return - - if(jobban_isbanned(M.brainmob, "AI") || jobban_isbanned(M.brainmob, "nonhumandept")) - to_chat(user, "This [P] does not seem to fit.") - return - - if(!M.brainmob.mind) - to_chat(user, "This [M.name] is mindless!") - return - - if(istype(P, /obj/item/mmi/syndie)) - to_chat(user, "This MMI does not seem to fit!") - return - - if(!user.drop_item()) - return - - M.forceMove(src) - brain = M - to_chat(user, "You add [M.name] to the frame.") - update_icon() + if(istype(P, /obj/item/mmi/syndie)) + to_chat(user, "This MMI does not seem to fit!") return - if(iscrowbar(P) && brain) - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You remove the brain.") - brain.forceMove(loc) - brain = null - update_icon() + if(!user.drop_item()) return - if(GLASS_CORE) - if(istype(P, /obj/item/crowbar)) - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You remove the glass panel.") - state = CABLED_CORE - update_icon() - new /obj/item/stack/sheet/rglass(loc, 2) - return + M.forceMove(src) + brain = M + to_chat(user, "You add [M.name] to the frame.") + update_icon() + return - if(isscrewdriver(P)) - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You connect the monitor.") - if(!brain) - var/open_for_latejoin = alert(user, "Would you like this core to be open for latejoining AIs?", "Latejoin", "Yes", "Yes", "No") == "Yes" - var/obj/structure/AIcore/deactivated/D = new(loc) - if(open_for_latejoin) - empty_playable_ai_cores += D - else - if(brain.brainmob.mind) - SSticker.mode.remove_cultist(brain.brainmob.mind, 1) - SSticker.mode.remove_revolutionary(brain.brainmob.mind, 1) - - var/mob/living/silicon/ai/A = new /mob/living/silicon/ai(loc, laws, brain) - if(A) //if there's no brain, the mob is deleted and a structure/AIcore is created - A.rename_self("AI", 1) - feedback_inc("cyborg_ais_created",1) - qdel(src) - - if(AI_READY_CORE) - if(istype(P, /obj/item/aicard)) - P.transfer_ai("INACTIVE", "AICARD", src, user) - return - - if(isscrewdriver(P)) - playsound(loc, P.usesound, 50, 1) - to_chat(user, "You disconnect the monitor.") - state = GLASS_CORE - update_icon() - return + if(AI_READY_CORE) + if(istype(P, /obj/item/aicard)) + P.transfer_ai("INACTIVE", "AICARD", src, user) + return return ..() +/obj/structure/AIcore/crowbar_act(mob/living/user, obj/item/I) + if(state !=CIRCUIT_CORE || state != GLASS_CORE || !(state == CABLED_CORE && brain)) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + switch(state) + if(CIRCUIT_CORE) + to_chat(user, "You remove the circuit board.") + state = EMPTY_CORE + circuit.forceMove(loc) + circuit = null + return + if(GLASS_CORE) + to_chat(user, "You remove the glass panel.") + state = CABLED_CORE + new /obj/item/stack/sheet/rglass(loc, 2) + return + if(CABLED_CORE) + if(brain) + to_chat(user, "You remove the brain.") + brain.forceMove(loc) + brain = null + update_icon() + +/obj/structure/AIcore/screwdriver_act(mob/living/user, obj/item/I) + if(!(state in list(SCREWED_CORE, CIRCUIT_CORE, GLASS_CORE, AI_READY_CORE))) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + switch(state) + if(SCREWED_CORE) + to_chat(user, "You unfasten the circuit board.") + state = CIRCUIT_CORE + if(CIRCUIT_CORE) + to_chat(user, "You screw the circuit board into place.") + state = SCREWED_CORE + if(GLASS_CORE) + to_chat(user, "You connect the monitor.") + if(!brain) + var/open_for_latejoin = alert(user, "Would you like this core to be open for latejoining AIs?", "Latejoin", "Yes", "Yes", "No") == "Yes" + var/obj/structure/AIcore/deactivated/D = new(loc) + if(open_for_latejoin) + empty_playable_ai_cores += D + else + if(brain.brainmob.mind) + SSticker.mode.remove_cultist(brain.brainmob.mind, 1) + SSticker.mode.remove_revolutionary(brain.brainmob.mind, 1) + + var/mob/living/silicon/ai/A = new /mob/living/silicon/ai(loc, laws, brain) + if(A) //if there's no brain, the mob is deleted and a structure/AIcore is created + A.rename_self("AI", 1) + feedback_inc("cyborg_ais_created",1) + qdel(src) + if(AI_READY_CORE) + to_chat(user, "You disconnect the monitor.") + state = GLASS_CORE + update_icon() + + +/obj/structure/AIcore/wirecutter_act(mob/living/user, obj/item/I) + if(state != CABLED_CORE) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(brain) + to_chat(user, "Get that [brain.name] out of there first!") + else + to_chat(user, "You remove the cables.") + state = SCREWED_CORE + update_icon() + var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( loc ) + A.amount = 5 + +/obj/structure/AIcore/wrench_act(mob/living/user, obj/item/I) + . = TRUE + if(!I.tool_use_check(user, 0)) + return + default_unfasten_wrench(user, I, 20) + /obj/structure/AIcore/update_icon() switch(state) if(EMPTY_CORE) @@ -237,6 +225,18 @@ new /obj/item/stack/sheet/plasteel(loc, 4) qdel(src) +/obj/structure/AIcore/welder_act(mob/user, obj/item/I) + if(!state) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_WELD_MESSAGE + if(I.use_tool(src, user, 20, volume = I.tool_volume)) + to_chat(user, "You deconstruct the frame.") + new /obj/item/stack/sheet/plasteel(drop_location(), 4) + qdel(src) + /obj/structure/AIcore/deactivated name = "inactive AI" icon_state = "ai-empty" diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index 545b0f61139..308b44e7a3c 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -454,17 +454,6 @@ anchored = 1 state = 1 return - if(istype(P, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = P - if(!WT.remove_fuel(0, user)) - to_chat(user, "The welding tool must be on to complete this task.") - return - playsound(loc, WT.usesound, 50, 1) - if(do_after(user, 20 * WT.toolspeed, target = src)) - if(!src || !WT.isOn()) return - to_chat(user, "You deconstruct the frame.") - deconstruct(TRUE) - return if(1) if(istype(P, /obj/item/wrench)) playsound(loc, P.usesound, 50, 1) @@ -573,6 +562,18 @@ return ..() +/obj/structure/computerframe/welder_act(mob/user, obj/item/I) + if(state) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_SLICING_MESSAGE + if(I.use_tool(src, user, 50, volume = I.tool_volume) && !state) + to_chat(user, "You deconstruct [src].") + deconstruct(TRUE) + + /obj/structure/computerframe/HONKputer name = "Bananium Computer-frame" @@ -588,17 +589,6 @@ to_chat(user, "You wrench the frame into place.") anchored = 1 state = 1 - if(istype(P, /obj/item/weldingtool)) - var/obj/item/weldingtool/WT = P - if(!WT.remove_fuel(0, user)) - to_chat(user, "The welding tool must be on to complete this task.") - return - playsound(loc, WT.usesound, 50, 1) - if(do_after(user, 20 * WT.toolspeed, target = src)) - if(!src || !WT.isOn()) return - to_chat(user, "You deconstruct the frame.") - deconstruct(TRUE) - return if(1) if(istype(P, /obj/item/wrench)) playsound(loc, P.usesound, 50, 1) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 805ce19aab5..6cf5f77a7f2 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -79,24 +79,24 @@ ui_interact(user) -/obj/machinery/computer/security/telescreen/attackby(obj/item/I, mob/user, params) - if(ismultitool(I)) - var/direction = input(user, "Which direction?", "Select direction!") as null|anything in list("North", "East", "South", "West", "Centre") - if(!direction || !Adjacent(user)) - return - pixel_x = 0 - pixel_y = 0 - switch(direction) - if("North") - pixel_y = 32 - if("East") - pixel_x = 32 - if("South") - pixel_y = -32 - if("West") - pixel_x = -32 - else - return ..() +/obj/machinery/computer/security/telescreen/multitool_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + var/direction = input(user, "Which direction?", "Select direction!") as null|anything in list("North", "East", "South", "West", "Centre") + if(!direction || !Adjacent(user)) + return + pixel_x = 0 + pixel_y = 0 + switch(direction) + if("North") + pixel_y = 32 + if("East") + pixel_x = 32 + if("South") + pixel_y = -32 + if("West") + pixel_x = -32 /obj/machinery/computer/security/emag_act(user as mob) if(!emagged) diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index 438c8f92246..aec41c80be3 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -133,10 +133,10 @@ if(istype(user, /mob/dead/observer)) return 0 return ..() -/obj/machinery/computer/attackby(obj/item/I, mob/user, params) - if(isscrewdriver(I) && circuit && !(flags & NODECONSTRUCT)) - playsound(loc, I.usesound, 50, TRUE) - if(do_after(user, 20 * I.toolspeed, target = src)) - deconstruct(TRUE, user) +/obj/machinery/computer/screwdriver_act(mob/user, obj/item/I) + . = TRUE + if(!I.tool_start_check(user, 0)) return - return ..() \ No newline at end of file + if(circuit && !(flags & NODECONSTRUCT)) + if(I.use_tool(src, user, 20, volume = I.tool_volume)) + deconstruct(TRUE, user) diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index fef40c9f93a..55107809ce3 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -35,11 +35,8 @@ light_color = LIGHT_COLOR_DARKGREEN -/obj/machinery/computer/message_monitor/attackby(obj/item/O as obj, mob/living/user as mob, params) - if(!istype(user)) - return - if(isscrewdriver(O) && emag) - //Stops people from just unscrewing the monitor and putting it back to get the console working again. +/obj/machinery/computer/message_monitor/screwdriver_act(mob/user, obj/item/I) + if(emag) //Stops people from just unscrewing the monitor and putting it back to get the console working again. to_chat(user, "It is too hot to mess with!") return return ..() diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index 36ad92714c6..b051ae34ca9 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -257,18 +257,20 @@ to destroy them and players will be able to make replacements. /obj/machinery/vending/modularpc = "Deluxe Silicate Selections", /obj/machinery/vending/crittercare = "CritterCare") -/obj/item/circuitboard/vendor/attackby(obj/item/I, mob/user, params) - if(isscrewdriver(I)) - var/static/list/display_vending_names_paths - if(!display_vending_names_paths) - display_vending_names_paths = list() - for(var/path in vending_names_paths) - display_vending_names_paths[vending_names_paths[path]] = path - var/choice = input(user, "Choose a new brand","Select an Item") as null|anything in display_vending_names_paths - set_type(display_vending_names_paths[choice]) - else - return ..() - +/obj/item/circuitboard/vendor/screwdriver_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + var/static/list/display_vending_names_paths + if(!display_vending_names_paths) + display_vending_names_paths = list() + for(var/path in vending_names_paths) + display_vending_names_paths[vending_names_paths[path]] = path + var/choice = input(user, "Choose a new brand","Select an Item") as null|anything in display_vending_names_paths + if(loc != user) + to_chat(user, "You need to keep [src] in your hands while doing that!") + return + set_type(display_vending_names_paths[choice]) /obj/item/circuitboard/vendor/proc/set_type(obj/machinery/vending/typepath) build_path = typepath @@ -583,20 +585,20 @@ to destroy them and players will be able to make replacements. /obj/item/stock_parts/manipulator = 1, /obj/item/stack/sheet/glass = 1) -/obj/item/circuitboard/chem_master/attackby(obj/item/I, mob/user, params) - if(isscrewdriver(I)) - var/new_name = "ChemMaster" - var/new_path = /obj/machinery/chem_master +/obj/item/circuitboard/chem_master/screwdriver_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + var/new_name = "ChemMaster" + var/new_path = /obj/machinery/chem_master - if(build_path == /obj/machinery/chem_master) - new_name = "CondiMaster" - new_path = /obj/machinery/chem_master/condimaster + if(build_path == /obj/machinery/chem_master) + new_name = "CondiMaster" + new_path = /obj/machinery/chem_master/condimaster - build_path = new_path - name = "circuit board ([new_name] 3000)" - to_chat(user, "You change the circuit board setting to \"[new_name]\".") - else - return ..() + build_path = new_path + name = "circuit board ([new_name] 3000)" + to_chat(user, "You change the circuit board setting to \"[new_name]\".") /obj/item/circuitboard/chem_master/condi_master name = "circuit board (CondiMaster 3000)" diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index bec6e329ad8..ded10e41a04 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -302,20 +302,9 @@ user.visible_message("[user] adds \a [B] to [src]!", "You add \a [B] to [src]!") return - - if(istype(G, /obj/item/screwdriver)) - if(occupant || on) - to_chat(user, "The maintenance panel is locked.") - return - default_deconstruction_screwdriver(user, "pod0-o", "pod0", G) - return - if(exchange_parts(user, G)) return - if(default_deconstruction_crowbar(G)) - return - if(istype(G, /obj/item/grab)) var/obj/item/grab/GG = G if(panel_open) @@ -332,6 +321,17 @@ return return ..() +/obj/machinery/atmospherics/unary/cryo_cell/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I)) + return + +/obj/machinery/atmospherics/unary/cryo_cell/screwdriver_act(mob/user, obj/item/I) + if(occupant || on) + to_chat(user, "The maintenance panel is locked.") + return TRUE + if(default_deconstruction_screwdriver(user, "pod0-o", "pod0", I)) + return TRUE + /obj/machinery/atmospherics/unary/cryo_cell/update_icon() handle_update_icon() diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 6c7b3b9c5a6..b1a78f2825f 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -398,6 +398,7 @@ GLOB.all_objectives -= O O.owner.objectives -= O qdel(O) + O.owner.announce_objectives() if(occupant.mind && occupant.mind.assigned_role) //Handle job slot/tater cleanup. var/job = occupant.mind.assigned_role diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 211f878231f..1fb2dfc422d 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -57,18 +57,19 @@ STOP_PROCESSING(SSobj, src) return ..() -/obj/machinery/disco/attackby(obj/item/O, mob/user, params) - if(!active) - if(iswrench(O)) - if(!anchored && !isinspace()) - to_chat(user,"You secure [src] to the floor.") - anchored = TRUE - else if(anchored) - to_chat(user,"You unsecure and disconnect [src].") - anchored = FALSE - playsound(src, 'sound/items/deconstruct.ogg', 50, 1) +/obj/machinery/disco/wrench_act(mob/user, obj/item/I) + if(active) return - return ..() + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(!anchored && !isinspace()) + anchored = TRUE + WRENCH_ANCHOR_MESSAGE + else if(anchored) + anchored = FALSE + WRENCH_UNANCHOR_MESSAGE + playsound(src, 'sound/items/deconstruct.ogg', 50, 1) /obj/machinery/disco/update_icon() if(active) diff --git a/code/game/machinery/defib_mount.dm b/code/game/machinery/defib_mount.dm index 5e173952a8e..738fc115734 100644 --- a/code/game/machinery/defib_mount.dm +++ b/code/game/machinery/defib_mount.dm @@ -98,16 +98,6 @@ else if(defib && I == defib.paddles) user.drop_item() return - else if(iswrench(I)) - if(!defib) - user.visible_message("[user] unwrenches [src] from the wall!", \ - "You unwrench [src]!") - new /obj/item/mounted/frame/defib_mount(get_turf(user)) - playsound(get_turf(src), I.usesound, 50, 1) - qdel(src) - return - to_chat(user, "The [defib] is blocking access to the bolts!") - return var/obj/item/card/id = I.GetID() if(id) if(check_access(id) || security_level >= SEC_LEVEL_RED) //anyone can toggle the clamps in red alert! @@ -122,6 +112,17 @@ return return ..() +/obj/machinery/defibrillator_mount/wrench_act(mob/user, obj/item/I) + . = TRUE + if(defib) + to_chat(user, "The [defib] is blocking access to the bolts!") + return + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + WRENCH_UNANCHOR_WALL_MESSAGE + new /obj/item/mounted/frame/defib_mount(get_turf(user)) + qdel(src) + /obj/machinery/defibrillator_mount/AltClick(mob/living/carbon/user) if(!istype(user)) return diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index 60d9953e980..f3f75f3c32c 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -29,17 +29,20 @@ if(stacktype) new stacktype(get_turf(src), drop_amount) -/obj/structure/barricade/attackby(obj/item/I, mob/user, params) - if(iswelder(I) && user.a_intent != INTENT_HARM && bar_material == METAL) - var/obj/item/weldingtool/WT = I - if(obj_integrity < max_integrity) - if(WT.remove_fuel(0, user)) - to_chat(user, "You begin repairing [src]...") - playsound(loc, WT.usesound, 40, 1) - if(do_after(user, 40 * I.toolspeed, target = src)) - obj_integrity = Clamp(obj_integrity + 20, 0, max_integrity) - else - return ..() +/obj/structure/barricade/welder_act(mob/user, obj/item/I) + if(obj_integrity >= max_integrity) + to_chat(user, "[src] does not need repairs.") + return + if(user.a_intent == INTENT_HARM) + return + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_REPAIR_MESSAGE + if(I.use_tool(src, user, 40, volume = I.tool_volume)) + WELDER_REPAIR_SUCCESS_MESSAGE + obj_integrity = Clamp(obj_integrity + 20, 0, max_integrity) + update_icon() + return TRUE /obj/structure/barricade/CanPass(atom/movable/mover, turf/target)//So bullets will fly over and stuff. if(locate(/obj/structure/barricade) in get_turf(mover)) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 610bbb73b06..26f0e2a2400 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -37,6 +37,7 @@ #define AIRLOCK_INTEGRITY_MULTIPLIER 1.5 // How much reinforced doors health increases #define AIRLOCK_DAMAGE_DEFLECTION_N 21 // Normal airlock damage deflection #define AIRLOCK_DAMAGE_DEFLECTION_R 30 // Reinforced airlock damage deflection + var/list/airlock_overlays = list() /obj/machinery/door/airlock @@ -823,14 +824,9 @@ About the new airlock wires panel: return 1 /obj/machinery/door/airlock/attackby(obj/item/C, mob/user, params) - if(shock_user(user, 75)) - return - add_fingerprint(user) - - if(headbutt_airlock(user))//See if the user headbutts the airlock + if(!headbutt_shock_check(user)) return - if(panel_open) switch(security_level) if(AIRLOCK_SECURITY_NONE) @@ -864,116 +860,7 @@ About the new airlock wires panel: damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R update_icon() return - if(AIRLOCK_SECURITY_METAL) - if(iswelder(C)) - var/obj/item/weldingtool/WT = C - if(!WT.remove_fuel(2, user)) - return - to_chat(user, "You begin cutting the panel's shielding...") - playsound(loc, WT.usesound, 40, 1) - if(do_after(user, 40 * WT.toolspeed, 1, target = src)) - if(!panel_open || !WT.isOn()) - return - playsound(loc, WT.usesound, 50, 1) - user.visible_message("[user] cuts through \the [src]'s shielding.", - "You cut through \the [src]'s shielding.", - "You hear welding.") - security_level = AIRLOCK_SECURITY_NONE - spawn_atom_to_turf(/obj/item/stack/sheet/metal, user.loc, 2) - update_icon() - return - if(AIRLOCK_SECURITY_PLASTEEL_I_S) - if(iscrowbar(C)) - var/obj/item/crowbar/W = C - to_chat(user, "You start removing the inner layer of shielding...") - playsound(src, W.usesound, 100, 1) - if(do_after(user, 40 * W.toolspeed, 1, target = src)) - if(!panel_open) - return - if(security_level != AIRLOCK_SECURITY_PLASTEEL_I_S) - return - user.visible_message("[user] remove \the [src]'s shielding.", - "You remove \the [src]'s inner shielding.") - security_level = AIRLOCK_SECURITY_NONE - modify_max_integrity(normal_integrity) - damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_N - spawn_atom_to_turf(/obj/item/stack/sheet/plasteel, user.loc, 1) - update_icon() - return - if(AIRLOCK_SECURITY_PLASTEEL_I) - if(iswelder(C)) - var/obj/item/weldingtool/WT = C - if(!WT.remove_fuel(2, user)) - return - to_chat(user, "You begin cutting the inner layer of shielding...") - playsound(loc, WT.usesound, 40, 1) - if(do_after(user, 40 * WT.toolspeed, 1, target = src)) - if(!panel_open || !WT.isOn()) - return - playsound(loc, WT.usesound, 50, 1) - user.visible_message("[user] cuts through \the [src]'s shielding.", - "You cut through \the [src]'s shielding.", - "You hear welding.") - security_level = AIRLOCK_SECURITY_PLASTEEL_I_S - return - if(AIRLOCK_SECURITY_PLASTEEL_O_S) - if(iscrowbar(C)) - var/obj/item/crowbar/W = C - to_chat(user, "You start removing outer layer of shielding...") - playsound(src, W.usesound, 100, 1) - if(do_after(user, 40 * W.toolspeed, 1, target = src)) - if(!panel_open) - return - if(security_level != AIRLOCK_SECURITY_PLASTEEL_O_S) - return - user.visible_message("[user] remove \the [src]'s shielding.", - "You remove \the [src]'s shielding.") - security_level = AIRLOCK_SECURITY_PLASTEEL_I - spawn_atom_to_turf(/obj/item/stack/sheet/plasteel, user.loc, 1) - return - if(AIRLOCK_SECURITY_PLASTEEL_O) - if(iswelder(C)) - var/obj/item/weldingtool/WT = C - if(!WT.remove_fuel(2, user)) - return - to_chat(user, "You begin cutting the outer layer of shielding...") - playsound(loc, WT.usesound, 40, 1) - if(do_after(user, 40 * WT.toolspeed, 1, target = src)) - if(!panel_open || !WT.isOn()) - return - playsound(loc, WT.usesound, 50, 1) - user.visible_message("[user] cuts through \the [src]'s shielding.", - "You cut through \the [src]'s shielding.", - "You hear welding.") - security_level = AIRLOCK_SECURITY_PLASTEEL_O_S - return - if(AIRLOCK_SECURITY_PLASTEEL) - if(iswirecutter(C)) - var/obj/item/wirecutters/W = C - if(arePowerSystemsOn() && shock(user, 60)) // Protective grille of wiring is electrified - return - to_chat(user, "You start cutting through the outer grille.") - playsound(src, W.usesound, 100, 1) - if(do_after(user, 10 * W.toolspeed, 1, target = src)) - if(!panel_open) - return - user.visible_message("[user] cut through \the [src]'s outer grille.", - "You cut through \the [src]'s outer grille.") - security_level = AIRLOCK_SECURITY_PLASTEEL_O - return - if(isscrewdriver(C)) - panel_open = !panel_open - to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the airlock.") - playsound(loc, C.usesound, 50, 1) - update_icon() - else if(iswirecutter(C)) - if(note) - remove_airlock_note(user, TRUE) - else - return interact_with_panel(user) - else if(ismultitool(C)) - return interact_with_panel(user) else if(istype(C, /obj/item/assembly/signaler)) return interact_with_panel(user) else if(istype(C, /obj/item/pai_cable)) // -- TLE @@ -993,102 +880,214 @@ About the new airlock wires panel: else return ..() -/obj/machinery/door/airlock/try_to_weld(obj/item/weldingtool/W, mob/user) - if(!operating && density) - if(user.a_intent != INTENT_HELP) - if(W.remove_fuel(0, user)) +/obj/machinery/door/airlock/screwdriver_act(mob/user, obj/item/I) + if(!headbutt_shock_check(user)) + return + if(user.a_intent == INTENT_HARM) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + panel_open = !panel_open + to_chat(user, "You [panel_open ? "open":"close"] [src]'s maintenance panel.") + update_icon() + +/obj/machinery/door/airlock/crowbar_act(mob/user, obj/item/I) + if(!headbutt_shock_check(user)) + return + if(user.a_intent == INTENT_HARM) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = 0)) + return + if(panel_open && security_level == AIRLOCK_SECURITY_PLASTEEL_I_S) + to_chat(user, "You start removing the inner layer of shielding...") + if(I.use_tool(src, user, 40, volume = I.tool_volume)) + if(!panel_open || security_level != AIRLOCK_SECURITY_PLASTEEL_I_S) + return + user.visible_message("[user] remove \the [src]'s shielding.", + "You remove \the [src]'s inner shielding.") + security_level = AIRLOCK_SECURITY_NONE + modify_max_integrity(normal_integrity) + damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_N + spawn_atom_to_turf(/obj/item/stack/sheet/plasteel, user.loc, 1) + update_icon() + else if(panel_open && security_level == AIRLOCK_SECURITY_PLASTEEL_O_S) + to_chat(user, "You start removing outer layer of shielding...") + if(I.use_tool(src, user, 40, volume = I.tool_volume)) + if(!panel_open || security_level != AIRLOCK_SECURITY_PLASTEEL_O_S) + return + user.visible_message("[user] remove \the [src]'s shielding.", + "You remove \the [src]'s shielding.") + security_level = AIRLOCK_SECURITY_PLASTEEL_I + spawn_atom_to_turf(/obj/item/stack/sheet/plasteel, user.loc, 1) + else + try_to_crowbar(user, I) + +/obj/machinery/door/airlock/wirecutter_act(mob/user, obj/item/I) + if(!headbutt_shock_check(user)) + return + if(!panel_open || user.a_intent == INTENT_HARM) + return + . = TRUE + if(!I.tool_start_check(user, 0)) + return + if(security_level == AIRLOCK_SECURITY_PLASTEEL) + if(arePowerSystemsOn() && shock(user, 60)) // Protective grille of wiring is electrified + return + to_chat(user, "You start cutting through the outer grille.") + if(I.use_tool(src, user, 10, volume = I.tool_volume)) + if(!panel_open || security_level != AIRLOCK_SECURITY_PLASTEEL) + return + user.visible_message("[user] cut through \the [src]'s outer grille.", + "You cut through \the [src]'s outer grille.") + security_level = AIRLOCK_SECURITY_PLASTEEL_O + return + if(note) + remove_airlock_note(user, TRUE) + else + return interact_with_panel(user) + +/obj/machinery/door/airlock/multitool_act(mob/user, obj/item/I) + if(!headbutt_shock_check(user)) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + interact_with_panel(user) + +/obj/machinery/door/airlock/welder_act(mob/user, obj/item/I) //This is god awful but I don't care + if(!headbutt_shock_check(user)) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + switch(security_level) + if(AIRLOCK_SECURITY_METAL) + to_chat(user, "You begin cutting the panel's shielding...") + if(!I.use_tool(src, user, 40, volume = I.tool_volume)) + return + if(!panel_open) + return + visible_message("[user] cuts through \the [src]'s shielding.", + "You cut through \the [src]'s shielding.", + "You hear welding.") + security_level = AIRLOCK_SECURITY_NONE + spawn_atom_to_turf(/obj/item/stack/sheet/metal, user.loc, 2) + if(AIRLOCK_SECURITY_PLASTEEL_O) + to_chat(user, "You begin cutting the outer layer of shielding...") + if(!I.use_tool(src, user, 40, volume = I.tool_volume)) + return + if(!panel_open) + return + visible_message("[user] cuts through \the [src]'s shielding.", + "You cut through \the [src]'s shielding.", + "You hear welding.") + security_level = AIRLOCK_SECURITY_PLASTEEL_O_S + if(AIRLOCK_SECURITY_PLASTEEL_I) + to_chat(user, "You begin cutting the inner layer of shielding...") + if(!I.use_tool(src, user, 40, volume = I.tool_volume)) + return + if(!panel_open) + return + user.visible_message("[user] cuts through \the [src]'s shielding.", + "You cut through \the [src]'s shielding.", + "You hear welding.") + security_level = AIRLOCK_SECURITY_PLASTEEL_I_S + else + if(user.a_intent != INTENT_HELP) user.visible_message("[user] is [welded ? "unwelding":"welding"] the airlock.", \ - "You begin [welded ? "unwelding":"welding"] the airlock...", \ - "You hear welding.") - playsound(loc, W.usesound, 40, 1) - if(do_after(user, 40 * W.toolspeed, 1, target = src, extra_checks = CALLBACK(src, .proc/weld_checks, W, user))) - playsound(loc, 'sound/items/welder2.ogg', 50, 1) + "You begin [welded ? "unwelding":"welding"] the airlock...", \ + "You hear welding.") + + if(I.use_tool(src, user, 40, volume = I.tool_volume, extra_checks = CALLBACK(src, .proc/weld_checks, I, user))) + if(!density && !welded) + return welded = !welded user.visible_message("[user.name] has [welded? "welded shut":"unwelded"] [src].", \ - "You [welded ? "weld the airlock shut":"unweld the airlock"].") + "You [welded ? "weld the airlock shut":"unweld the airlock"].") update_icon() - else - if(obj_integrity < max_integrity) - if(W.remove_fuel(0, user)) - user.visible_message("[user] is welding the airlock.", \ - "You begin repairing the airlock...", \ - "You hear welding.") - playsound(loc, W.usesound, 40, 1) - if(do_after(user, 40 * W.toolspeed, 1, target = src, extra_checks = CALLBACK(src, .proc/weld_checks, W, user))) - playsound(loc, 'sound/items/welder2.ogg', 50, 1) - obj_integrity = max_integrity - stat &= ~BROKEN - user.visible_message("[user.name] has repaired [src].", \ - "You finish repairing the airlock.") - update_icon() + else if(obj_integrity < max_integrity) + user.visible_message("[user] is welding the airlock.", \ + "You begin repairing the airlock...", \ + "You hear welding.") + if(I.use_tool(src, user, 40, volume = I.tool_volume, extra_checks = CALLBACK(src, .proc/weld_checks, I, user))) + obj_integrity = max_integrity + stat &= ~BROKEN + user.visible_message("[user.name] has repaired [src].", \ + "You finish repairing the airlock.") + update_icon() else to_chat(user, "The airlock doesn't need repairing.") + update_icon() -/obj/machinery/door/airlock/proc/weld_checks(obj/item/weldingtool/W, mob/user) - return !operating && density && user && W && W.isOn() && user.loc +/obj/machinery/door/airlock/proc/weld_checks(obj/item/I, mob/user) + return !operating && density && user && I && I.tool_use_check() && user.loc -/obj/machinery/door/airlock/try_to_crowbar(obj/item/I, mob/living/user) - var/beingcrowbarred = null - if(iscrowbar(I)) - beingcrowbarred = 1 - else - beingcrowbarred = 0 - if(beingcrowbarred && panel_open && ((emagged) || (density && welded && !operating && !arePowerSystemsOn() && !locked))) - playsound(loc, I.usesound, 100, 1) +/obj/machinery/door/airlock/proc/headbutt_shock_check(mob/user) + if(shock_user(user, 75)) + return + if(headbutt_airlock(user))//See if the user headbutts the airlock + return + return TRUE + +/obj/machinery/door/airlock/try_to_crowbar(mob/living/user, obj/item/I) //*scream + if(operating) + return + var/beingcrowbarred = FALSE + if(I.tool_behaviour == TOOL_CROWBAR && I.tool_use_check(user, 0)) + beingcrowbarred = TRUE + if(beingcrowbarred && panel_open && (emagged || (density && welded && !operating && !arePowerSystemsOn() && !locked))) user.visible_message("[user] removes the electronics from the airlock assembly.", \ "You start to remove electronics from the airlock assembly...") - if(do_after(user, 40 * I.toolspeed, target = src)) + if(I.use_tool(src, user, 40, volume = I.tool_volume)) deconstruct(TRUE, user) - return - else if(arePowerSystemsOn()) - to_chat(user, "The airlock's motors resist your efforts to force it!") - else if(locked) + return + if(welded) + to_chat(user, "[src] is welded shut!") + return + if(locked) to_chat(user, "The airlock's bolts prevent it from being forced!") - else if(!welded && !operating) - if(istype(I, /obj/item/twohanded/fireaxe)) //let's make this more specific - var/obj/item/twohanded/fireaxe/F = I - if(F.wielded) - spawn(0) - if(density) - open(1) - else - close(1) - else - to_chat(user, "You need to be wielding the fire axe to do that!") - else + return + if(istype(I, /obj/item/twohanded/fireaxe)) //let's make this more specific //FUCK YOU + var/obj/item/twohanded/fireaxe/F = I + if(F.wielded) spawn(0) if(density) open(1) else close(1) - - if(ispowertool(I)) //jaws of life and rescue claw - if(isElectrified()) - shock(user, 100)//it's like sticking a forck in a power socket + else + to_chat(user, "You need to be wielding the fire axe to do that!") return - - if(!density)//already open - return - - if(locked) - to_chat(user, "The bolts are down, it won't budge!") - return - - if(welded) - to_chat(user, "It's welded, it won't budge!") - return - - var/time_to_open = 5 - if(arePowerSystemsOn() && !prying_so_hard) - time_to_open = 50 - playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, 1) //is it aliens or just the CE being a dick? - prying_so_hard = TRUE - var/result = do_after(user, time_to_open, target = src) - prying_so_hard = FALSE - if(result) + else if(!arePowerSystemsOn()) + spawn(0) + if(density) open(1) - if(density && !open(1)) - to_chat(user, "Despite your attempts, [src] refuses to open.") + else + close(1) + return + else if(!ispowertool(I)) + to_chat(user, "The airlock's motors resist your efforts to force it!") + return + if(isElectrified()) + shock(user, 100)//it's like sticking a forck in a power socket + return + + if(!density)//already open + return + + var/time_to_open = 5 + if(!prying_so_hard) + time_to_open = 50 + playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, 1) //is it aliens or just the CE being a dick? + prying_so_hard = TRUE + var/result = do_after(user, time_to_open, target = src) + prying_so_hard = FALSE + if(result) + open(1) + if(density && !open(1)) + to_chat(user, "Despite your attempts, [src] refuses to open.") /obj/machinery/door/airlock/open(forced=0) if(operating || welded || locked || emagged) diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm index 59d99f501c0..fccb77c5e2a 100644 --- a/code/game/machinery/doors/airlock_types.dm +++ b/code/game/machinery/doors/airlock_types.dm @@ -379,14 +379,20 @@ return add_fingerprint(user) - if((iswelder(C) && !operating && density)) - var/obj/item/weldingtool/W = C - if(W.remove_fuel(0,user)) - welded = !welded - update_icon() - return - else - return + +/obj/machinery/door/airlock/hatch/gamma/welder_act(mob/user, obj/item/I) + if(shock_user(user, 75)) + return + if(operating || !density) + return + . = TRUE + if(!I.use_tool(src, user, 0, amount = 0, volume = I.tool_volume)) + return + welded = !welded + visible_message("[user] [welded ? null : "un"]welds [src]!",\ + "You [welded ? null : "un"]weld [src]!",\ + "You hear welding.") + update_icon() /obj/machinery/door/airlock/maintenance_hatch name = "maintenance hatch" @@ -424,14 +430,22 @@ return add_fingerprint(user) - if((iswelder(C) && !operating && density)) - var/obj/item/weldingtool/W = C - if(W.remove_fuel(0,user)) - welded = !welded - update_icon() - return - else - return + + +/obj/machinery/door/airlock/highsecurity/red/welder_act(mob/user, obj/item/I) + if(shock_user(user, 75)) + return + if(operating || !density) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + welded = !welded + visible_message("[user] [welded ? null : "un"]welds [src]!",\ + "You [welded ? null : "un"]weld [src]!",\ + "You hear welding.") + update_icon() + ////////////////////////////////// /* diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index d1144d7317d..e1a9e78f5b3 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -185,24 +185,27 @@ /obj/machinery/door/proc/unrestricted_side(mob/M) //Allows for specific side of airlocks to be unrestrected (IE, can exit maint freely, but need access to enter) return get_dir(src, M) & unres_sides -/obj/machinery/door/proc/try_to_weld(obj/item/weldingtool/W, mob/user) - return - /obj/machinery/door/proc/try_to_crowbar(obj/item/I, mob/user) return /obj/machinery/door/attackby(obj/item/I, mob/user, params) - if(user.a_intent != INTENT_HARM && (iscrowbar(I) || istype(I, /obj/item/twohanded/fireaxe))) + if(user.a_intent != INTENT_HARM && istype(I, /obj/item/twohanded/fireaxe)) try_to_crowbar(I, user) return 1 - else if(iswelder(I)) - try_to_weld(I, user) - return 1 else if(!(I.flags & NOBLUDGEON) && user.a_intent != INTENT_HARM) try_to_activate_door(user) return 1 return ..() + +/obj/machinery/door/crowbar_act(mob/user, obj/item/I) + if(user.a_intent == INTENT_HARM) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + try_to_crowbar(I, user) + /obj/machinery/door/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) . = ..() if(. && obj_integrity > 0) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 51bc7fdc457..e655add4ecb 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -84,47 +84,60 @@ if(operating) return - - if(welded) - if(iswrench(C)) - if(boltslocked) - to_chat(user, "There are screws locking the bolts in place!") - return - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] starts undoing [src]'s bolts...", \ - "You start unfastening [src]'s floor bolts...") - if(!do_after(user, 50 * C.toolspeed, target = src)) - return - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] unfastens [src]'s bolts.", \ - "You undo [src]'s floor bolts.") - deconstruct(TRUE) - return - if(isscrewdriver(C)) - user.visible_message("[user] [boltslocked ? "unlocks" : "locks"] [src]'s bolts.", \ - "You [boltslocked ? "unlock" : "lock"] [src]'s floor bolts.") - playsound(get_turf(src), C.usesound, 50, 1) - boltslocked = !boltslocked - return - return ..() /obj/machinery/door/firedoor/try_to_activate_door(mob/user) return -/obj/machinery/door/firedoor/try_to_weld(obj/item/weldingtool/W, mob/user) - if(W.remove_fuel(0, user)) - playsound(get_turf(src), W.usesound, 50, 1) - user.visible_message("[user] starts [welded ? "unwelding" : "welding"] [src].", "You start welding [src].") - if(do_after(user, 40 * W.toolspeed, 1, target=src)) - welded = !welded - to_chat(user, "[user] [welded ? "welds" : "unwelds"] [src].", "You [welded ? "weld" : "unweld"] [src].") - update_icon() +/obj/machinery/door/firedoor/screwdriver_act(mob/user, obj/item/I) + if(user.a_intent == INTENT_HARM) + return + if(operating || !welded) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + user.visible_message("[user] [boltslocked ? "unlocks" : "locks"] [src]'s bolts.", \ + "You [boltslocked ? "unlock" : "lock"] [src]'s floor bolts.") + boltslocked = !boltslocked + +/obj/machinery/door/firedoor/wrench_act(mob/user, obj/item/I) + if(user.a_intent == INTENT_HARM) + return + if(operating || !welded) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + if(boltslocked) + to_chat(user, "There are screws locking the bolts in place!") + return + user.visible_message("[user] starts undoing [src]'s bolts...", \ + "You start unfastening [src]'s floor bolts...") + if(!I.use_tool(src, user, 50, volume = I.tool_volume) || boltslocked) + return + user.visible_message("[user] unfastens [src]'s bolts.", \ + "You undo [src]'s floor bolts.") + deconstruct(TRUE) + +/obj/machinery/door/firedoor/welder_act(mob/user, obj/item/I) + if(!density) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_WELD_MESSAGE + if(!I.use_tool(src, user, 40, volume = I.tool_volume)) + return + if(!density) //In case someone opens it while it's getting welded + return + WELDER_WELD_SUCCESS_MESSAGE + welded = !welded + update_icon() /obj/machinery/door/firedoor/try_to_crowbar(obj/item/I, mob/user) if(welded || operating) return - if(density) open() else @@ -305,40 +318,6 @@ /obj/structure/firelock_frame/attackby(obj/item/C, mob/user) switch(constructionStep) if(CONSTRUCTION_PANEL_OPEN) - if(iscrowbar(C)) - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] starts prying something out from [src]...", \ - "You begin prying out the wire cover...") - if(!do_after(user, 50 * C.toolspeed, target = src)) - return - if(constructionStep != CONSTRUCTION_PANEL_OPEN) - return - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] pries out a metal plate from [src], exposing the wires.", \ - "You remove the cover plate from [src], exposing the wires.") - constructionStep = CONSTRUCTION_WIRES_EXPOSED - update_icon() - return - if(iswrench(C)) - if(locate(/obj/machinery/door/firedoor) in get_turf(src)) - to_chat(user, "There's already a firelock there.") - return - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] starts bolting down [src]...", \ - "You begin bolting [src]...") - if(!do_after(user, 30 * C.toolspeed, target = src)) - return - if(locate(/obj/machinery/door/firedoor) in get_turf(src)) - return - user.visible_message("[user] finishes the firelock.", \ - "You finish the firelock.") - playsound(get_turf(src), C.usesound, 50, 1) - if(reinforced) - new /obj/machinery/door/firedoor/heavy(get_turf(src)) - else - new /obj/machinery/door/firedoor(get_turf(src)) - qdel(src) - return if(istype(C, /obj/item/stack/sheet/plasteel)) var/obj/item/stack/sheet/plasteel/P = C if(reinforced) @@ -359,53 +338,7 @@ P.use(2) reinforced = 1 return - - if(CONSTRUCTION_WIRES_EXPOSED) - if(iswirecutter(C)) - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] starts cutting the wires from [src]...", \ - "You begin removing [src]'s wires...") - if(!do_after(user, 60 * C.toolspeed, target = src)) - return - if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) - return - user.visible_message("[user] removes the wires from [src].", \ - "You remove the wiring from [src], exposing the circuit board.") - var/obj/item/stack/cable_coil/B = new(get_turf(src)) - B.amount = 5 - constructionStep = CONSTRUCTION_GUTTED - update_icon() - return - if(iscrowbar(C)) - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] starts prying a metal plate into [src]...", \ - "You begin prying the cover plate back onto [src]...") - if(!do_after(user, 80 * C.toolspeed, target = src)) - return - if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) - return - playsound(get_turf(src), C.usesound, 50, 1) - user.visible_message("[user] pries the metal plate into [src].", \ - "You pry [src]'s cover plate into place, hiding the wires.") - constructionStep = CONSTRUCTION_PANEL_OPEN - update_icon() - return if(CONSTRUCTION_GUTTED) - if(iscrowbar(C)) - user.visible_message("[user] begins removing the circuit board from [src]...", \ - "You begin prying out the circuit board from [src]...") - playsound(get_turf(src), C.usesound, 50, 1) - if(!do_after(user, 50 * C.toolspeed, target = src)) - return - if(constructionStep != CONSTRUCTION_GUTTED) - return - user.visible_message("[user] removes [src]'s circuit board.", \ - "You remove the circuit board from [src].") - new /obj/item/firelock_electronics(get_turf(src)) - playsound(get_turf(src), C.usesound, 50, 1) - constructionStep = CONSTRUCTION_NOCIRCUIT - update_icon() - return if(iscoil(C)) var/obj/item/stack/cable_coil/B = C if(B.get_amount() < 5) @@ -424,26 +357,6 @@ constructionStep = CONSTRUCTION_WIRES_EXPOSED update_icon() return - if(CONSTRUCTION_NOCIRCUIT) - if(iswelder(C)) - var/obj/item/weldingtool/W = C - if(W.remove_fuel(1,user)) - playsound(get_turf(src), W.usesound, 50, 1) - user.visible_message("[user] begins cutting apart [src]'s frame...", \ - "You begin slicing [src] apart...") - if(!do_after(user, 40 * W.toolspeed, target = src)) - return - if(constructionStep != CONSTRUCTION_NOCIRCUIT) - return - user.visible_message("[user] cuts apart [src]!", \ - "You cut [src] into metal.") - playsound(get_turf(src), W.usesound, 50, 1) - var/turf/T = get_turf(src) - new /obj/item/stack/sheet/metal(T, 3) - if(reinforced) - new /obj/item/stack/sheet/plasteel(T, 2) - qdel(src) - return if(istype(C, /obj/item/firelock_electronics)) user.visible_message("[user] starts adding [C] to [src]...", \ "You begin adding a circuit board to [src]...") @@ -462,6 +375,109 @@ return return ..() +/obj/structure/firelock_frame/crowbar_act(mob/user, obj/item/I) + if(!(constructionStep in list(CONSTRUCTION_WIRES_EXPOSED, CONSTRUCTION_PANEL_OPEN, CONSTRUCTION_GUTTED))) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + if(constructionStep == CONSTRUCTION_WIRES_EXPOSED) + user.visible_message("[user] starts prying a metal plate into [src]...", \ + "You begin prying the cover plate back onto [src]...") + if(!I.use_tool(src, user, 50, volume = I.tool_volume)) + return + if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) + return + user.visible_message("[user] pries the metal plate into [src].", \ + "You pry [src]'s cover plate into place, hiding the wires.") + constructionStep = CONSTRUCTION_PANEL_OPEN + else if(constructionStep == CONSTRUCTION_PANEL_OPEN) + user.visible_message("[user] starts prying something out from [src]...", \ + "You begin prying out the wire cover...") + if(!I.use_tool(src, user, 50, volume = I.tool_volume)) + return + if(constructionStep != CONSTRUCTION_PANEL_OPEN) + return + user.visible_message("[user] pries out a metal plate from [src], exposing the wires.", \ + "You remove the cover plate from [src], exposing the wires.") + constructionStep = CONSTRUCTION_WIRES_EXPOSED + else if(constructionStep == CONSTRUCTION_GUTTED) + user.visible_message("[user] begins removing the circuit board from [src]...", \ + "You begin prying out the circuit board from [src]...") + if(!I.use_tool(src, user, 50, volume = I.tool_volume)) + return + if(constructionStep != CONSTRUCTION_GUTTED) + return + user.visible_message("[user] removes [src]'s circuit board.", \ + "You remove the circuit board from [src].") + new /obj/item/firelock_electronics(get_turf(src)) + constructionStep = CONSTRUCTION_NOCIRCUIT + update_icon() + +/obj/structure/firelock_frame/wirecutter_act(mob/user, obj/item/I) + if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) + return + . = TRUE + if(!I.tool_start_check(user, 0)) + return + + user.visible_message("[user] starts cutting the wires from [src]...", \ + "You begin removing [src]'s wires...") + if(!I.use_tool(src, user, 50, volume = I.tool_volume)) + return + if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) + return + user.visible_message("[user] removes the wires from [src].", \ + "You remove the wiring from [src], exposing the circuit board.") + var/obj/item/stack/cable_coil/B = new(get_turf(src)) + B.amount = 5 + constructionStep = CONSTRUCTION_GUTTED + update_icon() + +/obj/structure/firelock_frame/wrench_act(mob/user, obj/item/I) + if(constructionStep != CONSTRUCTION_PANEL_OPEN) + return + . = TRUE + if(locate(/obj/machinery/door/firedoor) in get_turf(src)) + to_chat(user, "There's already a firelock there.") + return + if(!I.tool_start_check(user, 0)) + return + user.visible_message("[user] starts bolting down [src]...", \ + "You begin bolting [src]...") + if(!I.use_tool(src, user, 50, volume = I.tool_volume)) + return + if(locate(/obj/machinery/door/firedoor) in get_turf(src)) + return + user.visible_message("[user] finishes the firelock.", \ + "You finish the firelock.") + if(reinforced) + new /obj/machinery/door/firedoor/heavy(get_turf(src)) + else + new /obj/machinery/door/firedoor(get_turf(src)) + qdel(src) + + + + + +/obj/structure/firelock_frame/welder_act(mob/user, obj/item/I) + if(constructionStep != CONSTRUCTION_NOCIRCUIT) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + WELDER_ATTEMPT_SLICING_MESSAGE + if(!I.use_tool(src, user, 40, amount = 1, volume = I.tool_volume)) + return + if(constructionStep != CONSTRUCTION_NOCIRCUIT) + return + WELDER_SLICING_SUCCESS_MESSAGE + new /obj/item/stack/sheet/metal(drop_location(), 3) + if(reinforced) + new /obj/item/stack/sheet/plasteel(drop_location(), 2) + qdel(src) + /obj/structure/firelock_frame/heavy name = "heavy firelock frame" reinforced = 1 @@ -470,4 +486,4 @@ #undef CONSTRUCTION_PANEL_OPEN #undef CONSTRUCTION_WIRES_EXPOSED #undef CONSTRUCTION_GUTTED -#undef CONSTRUCTION_NOCIRCUIT \ No newline at end of file +#undef CONSTRUCTION_NOCIRCUIT diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 1bf5a31d336..2755392aa53 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -231,69 +231,79 @@ return add_fingerprint(user) - - if(!(flags & NODECONSTRUCT)) - if(isscrewdriver(I)) - if(density || operating) - to_chat(user, "You need to open the door to access the maintenance panel!") - return - playsound(src.loc, I.usesound, 50, 1) - panel_open = !panel_open - to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the [src.name].") - return - - if(iscrowbar(I)) - if(panel_open && !density && !operating) - playsound(loc, I.usesound, 100, 1) - user.visible_message("[user] removes the electronics from the [name].", \ - "You start to remove electronics from the [name]...") - if(do_after(user, 40 * I.toolspeed, target = src)) - if(panel_open && !density && !operating && loc) - var/obj/structure/windoor_assembly/WA = new /obj/structure/windoor_assembly(loc) - switch(base_state) - if("left") - WA.facing = "l" - if("right") - WA.facing = "r" - if("leftsecure") - WA.facing = "l" - WA.secure = TRUE - if("rightsecure") - WA.facing = "r" - WA.secure = TRUE - WA.anchored = TRUE - WA.state= "02" - WA.setDir(dir) - WA.ini_dir = dir - WA.update_icon() - WA.created_name = name - - if(emagged) - to_chat(user, "You discard the damaged electronics.") - qdel(src) - return - - to_chat(user, "You remove the airlock electronics.") - - var/obj/item/airlock_electronics/ae - if(!electronics) - ae = new/obj/item/airlock_electronics(loc) - if(!req_access) - check_access() - if(req_access.len) - ae.conf_access = req_access - else if(req_one_access.len) - ae.conf_access = req_one_access - ae.one_access = 1 - else - ae = electronics - electronics = null - ae.forceMove(loc) - - qdel(src) - return return ..() +/obj/machinery/door/window/screwdriver_act(mob/user, obj/item/I) + if(flags & NODECONSTRUCT) + return + . = TRUE + if(density || operating) + to_chat(user, "You need to open the door to access the maintenance panel!") + return + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + panel_open = !panel_open + to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the [src.name].") + + +/obj/machinery/door/window/crowbar_act(mob/user, obj/item/I) + if(operating) + return + if(flags & NODECONSTRUCT) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + if(panel_open && !density && !operating) + user.visible_message("[user] removes the electronics from the [name].", \ + "You start to remove electronics from the [name]...") + if(I.use_tool(src, user, 40, volume = I.tool_volume)) + if(panel_open && !density && !operating && loc) + var/obj/structure/windoor_assembly/WA = new /obj/structure/windoor_assembly(loc) + switch(base_state) + if("left") + WA.facing = "l" + if("right") + WA.facing = "r" + if("leftsecure") + WA.facing = "l" + WA.secure = TRUE + if("rightsecure") + WA.facing = "r" + WA.secure = TRUE + WA.anchored = TRUE + WA.state= "02" + WA.setDir(dir) + WA.ini_dir = dir + WA.update_icon() + WA.created_name = name + + if(emagged) + to_chat(user, "You discard the damaged electronics.") + qdel(src) + return + + to_chat(user, "You remove the airlock electronics.") + + var/obj/item/airlock_electronics/ae + if(!electronics) + ae = new/obj/item/airlock_electronics(loc) + if(!req_access) + check_access() + if(req_access.len) + ae.conf_access = req_access + else if(req_one_access.len) + ae.conf_access = req_one_access + ae.one_access = 1 + else + ae = electronics + electronics = null + ae.forceMove(loc) + + qdel(src) + else + try_to_crowbar(I, user) + /obj/machinery/door/window/try_to_crowbar(obj/item/I, mob/user) if(!hasPower()) if(density) diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index d4dc8f854ef..d0fe753a9de 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -41,17 +41,6 @@ var/list/doppler_arrays = list() return PROCESS_KILL /obj/machinery/doppler_array/attackby(obj/item/I, mob/user, params) - if(iswrench(I)) - if(!anchored && !isinspace()) - anchored = TRUE - power_change() - to_chat(user, "You fasten [src].") - else if(anchored) - anchored = FALSE - power_change() - to_chat(user, "You unfasten [src].") - playsound(loc, I.usesound, 50, 1) - return if(istype(I, /obj/item/disk/tech_disk)) var/obj/item/disk/tech_disk/disk = I disk.load_tech(toxins_tech) @@ -59,6 +48,18 @@ var/list/doppler_arrays = list() return return ..() +/obj/machinery/doppler_array/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + if(!anchored && !isinspace()) + anchored = TRUE + WRENCH_ANCHOR_MESSAGE + else if(anchored) + anchored = FALSE + WRENCH_UNANCHOR_MESSAGE + power_change() + /obj/machinery/doppler_array/attack_hand(mob/user) if(..()) return diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 255d8d3cce1..7ae268fca46 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -1,6 +1,11 @@ /* FIRE ALARM */ + +#define FIRE_ALARM_FRAME 0 +#define FIRE_ALARM_UNWIRED 1 +#define FIRE_ALARM_READY 2 + /obj/machinery/firealarm name = "fire alarm" desc = "\"Pull this in case of emergency\". Thus, keep pulling it forever." @@ -83,68 +88,94 @@ FIRE ALARM /obj/machinery/firealarm/attackby(obj/item/I, mob/user, params) add_fingerprint(user) - - if(isscrewdriver(I) && buildstage == 2) - wiresexposed = !wiresexposed - update_icon() - return - if(wiresexposed) - switch(buildstage) - if(2) - if(ismultitool(I)) - detecting = !detecting - if(detecting) - user.visible_message("[user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.") - else - user.visible_message("[user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.") - - else if(iswirecutter(I)) // cutting the wires out + if(buildstage == FIRE_ALARM_UNWIRED) + if(istype(I, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/coil = I + if(!coil.use(5)) to_chat(user, "You cut the wires!") - playsound(loc, I.usesound, 50, 1) - var/obj/item/stack/cable_coil/new_coil = new /obj/item/stack/cable_coil() - new_coil.amount = 5 - new_coil.forceMove(user.loc) - buildstage = 1 - update_icon() - if(1) - if(istype(I, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/coil = I - if(!coil.use(5)) - to_chat(user, "You cut the wires!") - return - - buildstage = 2 - playsound(get_turf(src), I.usesound, 50, 1) - to_chat(user, "You wire [src]!") - update_icon() - - else if(iscrowbar(I)) - to_chat(user, "You pry out the circuit!") - playsound(get_turf(src), I.usesound, 50, 1) - if(do_after(user, 20 * I.toolspeed, target = src)) - if(buildstage != 1) - return - var/obj/item/firealarm_electronics/circuit = new /obj/item/firealarm_electronics() - circuit.forceMove(get_turf(src)) - buildstage = 0 - update_icon() - if(0) - if(istype(I, /obj/item/firealarm_electronics)) - to_chat(user, "You insert the circuit!") - qdel(I) - buildstage = 1 - update_icon() - - else if(iswrench(I)) - to_chat(user, "You remove the fire alarm assembly from the wall!") - new /obj/item/mounted/frame/firealarm(get_turf(user)) - playsound(get_turf(src), I.usesound, 50, 1) - qdel(src) + return + buildstage = FIRE_ALARM_READY + playsound(get_turf(src), I.usesound, 50, 1) + to_chat(user, "You wire [src]!") + update_icon() + if(buildstage == FIRE_ALARM_FRAME) + if(istype(I, /obj/item/firealarm_electronics)) + to_chat(user, "You insert the circuit!") + qdel(I) + buildstage = FIRE_ALARM_UNWIRED + update_icon() return return ..() +/obj/machinery/firealarm/crowbar_act(mob/user, obj/item/I) + if(buildstage != FIRE_ALARM_UNWIRED) + return + . = TRUE + if(!I.tool_use_check(user, 0)) + return + CROWBAR_ATTEMPT_PRY_CIRCUIT_MESSAGE + if(!I.use_tool(src, user, 20, volume = I.tool_volume) || buildstage != FIRE_ALARM_UNWIRED) + return + new /obj/item/firealarm_electronics(drop_location()) + buildstage = FIRE_ALARM_FRAME + update_icon() + CROWBAR_PRY_CIRCUIT_SUCCESS_MESSAGE + +/obj/machinery/firealarm/multitool_act(mob/user, obj/item/I) + if(buildstage != FIRE_ALARM_READY) + return + . = TRUE + if(!wiresexposed) + to_chat(user, "You need to expose the wires first!") + return + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + detecting = !detecting + if(detecting) + user.visible_message("[user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.") + else + user.visible_message("[user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.") + +/obj/machinery/firealarm/screwdriver_act(mob/user, obj/item/I) + if(buildstage != FIRE_ALARM_READY) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + wiresexposed = !wiresexposed + if(wiresexposed) + SCREWDRIVER_OPEN_PANEL_MESSAGE + else + SCREWDRIVER_CLOSE_PANEL_MESSAGE + update_icon() + +/obj/machinery/firealarm/wirecutter_act(mob/user, obj/item/I) + if(buildstage != FIRE_ALARM_READY) + return + . = TRUE + if(!wiresexposed) + to_chat(user, "You need to expose the wires first!") + return + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + WIRECUTTER_SNIP_MESSAGE + var/obj/item/stack/cable_coil/new_coil = new /obj/item/stack/cable_coil(drop_location()) + new_coil.amount = 5 + buildstage = FIRE_ALARM_UNWIRED + + +/obj/machinery/firealarm/wrench_act(mob/user, obj/item/I) + if(buildstage != FIRE_ALARM_FRAME) + return + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + WRENCH_UNANCHOR_WALL_MESSAGE + new /obj/item/mounted/frame/firealarm(get_turf(user)) + qdel(src) + /obj/machinery/firealarm/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) . = ..() if(.) //damage received @@ -406,3 +437,8 @@ Just a object used in constructing fire alarms usr << browse(null, "window=partyalarm") return return + + +#undef FIRE_ALARM_FRAME +#undef FIRE_ALARM_UNWIRED +#undef FIRE_ALARM_READY diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 30069ff0310..1f42a6a78c4 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -40,18 +40,6 @@ icon_state = "[base_state]1-p" // sd_set_light(0) -//Don't want to render prison breaks impossible -/obj/machinery/flasher/attackby(obj/item/I, mob/user, params) - if(iswirecutter(I)) - add_fingerprint(user) - disable = !disable - if(disable) - user.visible_message("[user] has disconnected [src]'s flashbulb!", "You disconnect [src]'s flashbulb!") - if(!disable) - user.visible_message("[user] has connected [src]'s flashbulb!", "You connect [src]'s flashbulb!") - else - return ..() - //Let the AI trigger them directly. /obj/machinery/flasher/attack_ai(mob/user) if(anchored) @@ -100,20 +88,28 @@ if((M.m_intent != MOVE_INTENT_WALK) && (anchored)) flash() -/obj/machinery/flasher/portable/attackby(obj/item/I, mob/user, params) - if(iswrench(I)) - add_fingerprint(user) - anchored = !anchored +//Don't want to render prison breaks impossible +/obj/machinery/flasher/portable/wirecutter_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + disable = !disable + if(disable) + user.visible_message("[user] has disconnected [src]'s flashbulb!", "You disconnect [src]'s flashbulb!") + if(!disable) + user.visible_message("[user] has connected [src]'s flashbulb!", "You connect [src]'s flashbulb!") - if(!anchored) - user.show_message(text("[src] can now be moved.")) - overlays.Cut() - - else if(anchored) - user.show_message(text("[src] is now secured.")) - overlays += "[base_state]-s" - else - return ..() +/obj/machinery/flasher/portable/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + anchored = !anchored + if(anchored) + WRENCH_ANCHOR_MESSAGE + overlays.Cut() + else if(anchored) + WRENCH_UNANCHOR_MESSAGE + overlays += "[base_state]-s" // Flasher button /obj/machinery/flasher_button diff --git a/code/game/machinery/gameboard.dm b/code/game/machinery/gameboard.dm index 2df0496ae67..edc1d3499ec 100644 --- a/code/game/machinery/gameboard.dm +++ b/code/game/machinery/gameboard.dm @@ -93,10 +93,10 @@ if(href_list["close"]) close_game() -/obj/machinery/gameboard/attackby(obj/item/I, mob/user, params) - if(default_unfasten_wrench(user, I)) - return +/obj/machinery/gameboard/crowbar_act(mob/user, obj/item/I) + if(default_deconstruction_crowbar(user, I, ignore_panel = TRUE)) + return TRUE - if(default_deconstruction_crowbar(I, ignore_panel = TRUE)) - return - return ..() +/obj/machinery/gameboard/wrench_act(mob/user, obj/item/I) + if(default_unfasten_wrench(user, I)) + return TRUE diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index d1df960716c..ef0ae0f2812 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -100,19 +100,22 @@ var/list/holopads = list() holo_range = holograph_range /obj/machinery/hologram/holopad/attackby(obj/item/I, mob/user, params) - if(default_deconstruction_screwdriver(user, "holopad_open", "holopad0", I)) - return - if(exchange_parts(user, I)) return - - if(default_unfasten_wrench(user, I)) - return - - if(default_deconstruction_crowbar(I)) - return return ..() +/obj/machinery/hologram/holopad/screwdriver_act(mob/user, obj/item/I) + . = TRUE + default_deconstruction_screwdriver(user, "holopad_open", "holopad0", I) + + +/obj/machinery/hologram/holopad/wrench_act(mob/user, obj/item/I) + . = TRUE + default_unfasten_wrench(user, I) + +/obj/machinery/hologram/holopad/crowbar_act(mob/user, obj/item/I) + . = TRUE + default_deconstruction_crowbar(user, I) /obj/machinery/hologram/holopad/attack_hand(mob/living/carbon/human/user) if(..()) diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 45056369662..e4bdb0d5478 100755 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -78,21 +78,23 @@ /obj/machinery/sparker/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/detective_scanner)) return - if(isscrewdriver(I)) - add_fingerprint(user) - disable = !disable - if(disable) - user.visible_message("[user] has disabled [src]!", "You disable the connection to [src].") - icon_state = "[base_state]-d" - if(!disable) - user.visible_message("[user] has reconnected [src]!", "You fix the connection to [src].") - if(powered()) - icon_state = "[base_state]" - else - icon_state = "[base_state]-p" - return return ..() +/obj/machinery/sparker/screwdriver_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + disable = !disable + if(disable) + user.visible_message("[user] has disabled [src]!", "You disable the connection to [src].") + icon_state = "[base_state]-d" + if(!disable) + user.visible_message("[user] has reconnected [src]!", "You fix the connection to [src].") + if(powered()) + icon_state = "[base_state]" + else + icon_state = "[base_state]-p" + /obj/machinery/sparker/attack_ai() if(src.anchored) return src.spark() diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 4d27ad6b5b5..13406ac4b0f 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -147,21 +147,26 @@ /obj/machinery/light_switch/attackby(obj/item/W as obj, mob/user as mob, params) if(istype(W, /obj/item/detective_scanner)) return - - if(istype(W, /obj/item/multitool)) - update_multitool_menu(user) - return 1 - - if(istype(W, /obj/item/wrench)) - playsound(get_turf(src), W.usesound, 50, 1) - if(do_after(user, 30 * W.toolspeed, target = src)) - to_chat(user, "You detach \the [src] from the wall.") - new/obj/item/mounted/frame/light_switch(get_turf(src)) - qdel(src) - return 1 - return ..() +/obj/machinery/light_switch/multitool_act(mob/user, obj/item/I) + . = TRUE + if(!I.use_tool(src, user, 0, volume = I.tool_volume)) + return + update_multitool_menu(user) + +/obj/machinery/light_switch/wrench_act(mob/user, obj/item/I) + . = TRUE + if(!I.tool_use_check(user, 0)) + return + user.visible_message("[user] starts unwrenching [src] from the wall...", "You are unwrenching [src] from the wall...", "You hear ratcheting.") + . = TRUE + if(!I.use_tool(src, user, 30, volume = I.tool_volume)) + return + WRENCH_UNANCHOR_WALL_MESSAGE + new/obj/item/mounted/frame/light_switch(get_turf(src)) + qdel(src) + /obj/machinery/light_switch/multitool_menu(var/mob/user, var/obj/item/multitool/P) return {"